neo4j-labs / neodash

NeoDash - a Dashboard Builder for Neo4j
https://neo4j.com/labs/neodash/
Apache License 2.0
397 stars 129 forks source link

A neodash parameter should be usable within a CALL {} to allow dynamic selection of composite databases #860

Open pdrangeid opened 3 months ago

pdrangeid commented 3 months ago

We use composite databases to provide a rotating week of data ourdb.week0, ourdb.week1,ourdb.week2 - these are aliases - the physical DB names will change as we spin up new dbs - but the composite names allow us to cycle through the most recent x weeks.

When I try this within a neodash report: CALL { use $neodash_selected_db }

I get an error: Invalid input '$': expected "(", "GRAPH" or an identifier "use $neodash_selected_database" ^

Describe the solution you'd like I can create a parameter selection by manually (although dynamically would be even better) WITH ['ourdb.week0','ourdb.week1','ourdb.week2'] as dbchoices UNWIND dbchoices as dbchoice WITH dbchoice WHERE dbchoice contains toLower($input) RETURN DISTINCT dbchoice as value,dbchoice as display order by dbchoice ASC Describe alternatives you've considered The alternative is pre-creating multiple pages of the same neodash reports one TAB per database, but this is an ugly UI and requires lots of manual editing copy/paste

Additional context My example is for composite database use (within a subcall statement in the report) but generally I think the ability to use a parameter for the database selection for any neodash report could be very helpful in many use cases

alfredorubin96 commented 3 months ago

Hi @pdrangeid , this is not a problem with parameters, but with Cypher: you see, you can't use parameters for that kind of function. One idea would be to create a new symbol, that is still a parameter, but that is materialised inside the query as a string

as an example -> MATCH (n : %new_kind_of_param) RETURN n If the param exists, using the % symbol should do an interpolation between the query and the parameter.