Search code examples
c#neo4jclient

Neo4j c# toInteger cypher


I have a database that stores client's tickets bought. It stores the quantity of tickets sold in each relationship, I need to display the events ordered by the quantity in each relationship. The problem is that said quantity is stored as an integer, researching i found the toInteger() function that converts the strings into integers and then I get the ordered list. But when I try to implement said cypher in my C# application I cannot find a way to use toInteger().

Neo4j Cypher (that works correctly)

MATCH(Cliente)-[r:Compro]->(b) return b.nombreEvento order by toInteger(r.cantidad) desc limit 5

C# Cypher Try

graphClient.Cypher
            .Match("(Cliente) -[r: Compro]->(b)")
            .Return(b => b.As<Cine>().nombreEvento)
            .OrderByDescending("r.cantidad")
            .Limit(5)
            .Results.ToList();

I am using Neo4jClient package for C#.

Does anyone know if said function can be used in Neo4jClient? Or help me by pointing me in the right direction.


Solution

  • Simply add in the .OrderByDescending() the toInteger() function like a string.

    For example:

    order by toInteger(r.cantidad) desc
    

    would become:

    .OrderByDescending("toInteger(r.cantidad)")