Showing results for 
Search instead for 
Did you mean: 

Head's Up! Site migration is underway. Phase 2: migrate recent content

Help using in Neodash report


Hello! I'm trying to use to include some conditional logic for a results table in a Neodash app. Code looks like this:

[$neodash__settings_oracle_depth_value = 'Schema' ,
"MATCH (n:TABLE{owner: '" + $neodash_table_owner + "'}) CALL apoc.path.subgraphNodes(n, {relationshipFilter:'<'}) YIELD node RETURN node.owner AS Schema, COUNT(node) AS Count",
$neodash__settings_oracle_depth_value = 'Table' ,
"MATCH (n:TABLE{owner: '" + $neodash_table_owner + "', name: '" + $neodash_table_name + "'}) CALL apoc.path.subgraphNodes(n, {relationshipFilter:'<'}) YIELD node RETURN node.owner AS Schema, COUNT(node) AS Count",
$neodash__settings_oracle_depth_value = 'Column' ,
"MATCH (n:COLUMN{owner: '" + $neodash_table_owner + "', object_name: '" + $neodash_table_name + "', name: '"+ $neodash_column_name + "'}) CALL apoc.path.subgraphNodes(n,{relationshipFilter:'<'}) YIELD node RETURN node.owner AS Schema, COUNT(node) AS Count"

Each of the queries works fine individually but when I use them with the results come out looking like this in a single column:



Anyone got any ideas what I'm doing wrong here?




From the docs, it looks like returns a map of the results; therefore, you are receiving a map with 'Schema' and 'Count' as keys. I don't understand where the value of 'Count' is getting compute as another map with both a 'high' and 'low' value is coming from.  What output do you want?

One thing you can do to have more control over the output is to remove the 'CALL apoc.path.subgraphNodes' call to outside the, as all are the same for each case statement. Instead, your 'case' statement returns 'n' in a map, which you can extract and pass to the 'path' call. You can them format the data as you require it.

Fortunately I've managed to figure this out!

1) The "high" and "low" weirdness is apparently something to due with Javascript not doing 64bit numbers. I won't even pretend to care about that because actually when solved it doesn't matter.

2) All I had to do was add YIELD value RETURN value.Schema, value.Count after the apoc.casefunction call.

This would be a case (pun not intended) where having some actual meaningful code snippets in the documentation would be useful to understand how a function actually works. Given there's little to zero community discussion (at least findable on google) about specific functions and their usage it certainly would be nice to see some non-trivial code snippets added to documentation.

Yes, the reason ‘yield value return value.schema, value.count’ works is because ‘value’ is a map with properties ‘schema’ and ‘ count’ in your case.  You can access map values with dot notation, as you figured out. 

I agree that the apoc documentation can be lacking, or event confusing at times.