You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/scenarioParametersConfiguration.md
+16-6Lines changed: 16 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -206,9 +206,11 @@ parameters:
206
206
query: 'MATCH(n:Customer) RETURN n.id as id'
207
207
resultKey: id
208
208
```
209
+
209
210
### Dynamic values for int and number parameters
210
-
Initial value for **int** and **number** parameters can be fetched dynamically from the scenario dataset. This feature
211
-
is supported for numeric inputs, but it is not yet available for **SLIDER** subtype.
211
+
212
+
An initial value for **int** and **number** parameters can be fetched dynamically from the scenario dataset. This
213
+
feature is supported for numeric inputs, but it is not yet available for the **SLIDER** subtype.
212
214
213
215
To configure the feature, you have to define `options.dynamicValues`, an object with the following keys:
214
216
@@ -220,6 +222,9 @@ To configure the feature, you have to define `options.dynamicValues`, an object
220
222
- `resultKey`: the alias defined in your query after `as` keyword, any string of your choice; providing this value is
221
223
required for the webapp to parse the cypher query results, and retrieve the actual value to display in the input
222
224
225
+
Please note that you must not define both `defaultValue` and `options.dynamicValues`. Defining both of these options
226
+
will lead to undefined behavior (in most cases, the cypher query will be ignored).
227
+
223
228
Configuration example :
224
229
225
230
```yaml
@@ -229,7 +234,7 @@ parameters:
229
234
fr: Customers
230
235
en: Customers
231
236
varType: int
232
-
defaultValue: 10 # if a default value is defined, it will be displayed in case if the cypher query fails
237
+
defaultValue: null # reminder that defaultValue must not be defined, otherwise the cypher query may be ignored
233
238
options:
234
239
dynamicValues:
235
240
type: cypher
@@ -329,38 +334,43 @@ parameters:
329
334
canChangeRowsNumber: false
330
335
dateFormat: 'dd/MM/yyyy'
331
336
```
337
+
332
338
#### Data source
339
+
333
340
By default, the table component is empty but if you want to display some data, you can define either a default or dynamic
334
341
value for the parameter. You can provide the id of an existing dataset in the `defaultValue` property of the parameter
335
342
description (this dataset must be a CSV file, with values separated by commas). If you want to fetch data from scenario's
336
343
dataset, you can use `dynamicValues` option that uses a cypher query to retrieve data from twingraph dataset.
337
344
338
345
_Note: only a **cypher** query from **twingraph** dataset is supported_
339
346
340
-
341
347
`dynamicValues` is an object with the following keys:
342
348
343
349
- `query`: the cypher query to run on a twingraph dataset; this query must retrieve a list of property values of the
344
-
graph elements, and return them with an alias (example: `MATCH(n:Customer) WITH {name: n.name, age: n.age} as alias
350
+
graph elements, and return them with an alias (example: `MATCH(n:Customer) WITH {name: n.name, age: n.age} as alias
345
351
RETURN alias`). Names of the properties must correspond to the `field` key in columns definition.
346
352
- `resultKey`: the alias defined in your query after `as` keyword, any string of your choice; providing this value is required for the webapp to parse the cypher
347
353
query results, and retrieve values to display in the table
348
354
349
355
Example of typical queries:
350
356
351
357
_Retrieve nodes from dataset, e.g., all customers list displayed in a table with two columns: name and satisfaction_
358
+
352
359
```yaml
353
360
query: 'MATCH(customer: Customer) WITH {name: customer.id, satisfaction: customer.Satisfaction} as rows RETURN rows',
354
361
resultKey: 'rows'
355
362
```
363
+
356
364
_Retrieve edges from dataset, e.g. relationship between all bars and customers displayed in a table with three columns:
357
365
bar, customer and relation_
366
+
358
367
```yaml
359
368
query: 'MATCH (b:Bar)-[r]->(c:Customer) WITH {bar: b.id, customer: c.id, relation: r.name } as rows RETURN rows',
360
369
resultKey: 'rows'
361
370
```
362
371
363
372
Complete example:
373
+
364
374
```yaml
365
375
parameters:
366
376
- id: 'customers'
@@ -387,7 +397,7 @@ parameters:
387
397
canChangeRowsNumber: false
388
398
```
389
399
390
-
_Known issue: Dynamic parameters are not saved as scenario parameters if they weren't displayed.
400
+
_Known issue: Dynamic parameters are not saved as scenario parameters if they weren't displayed.
391
401
In order to save it, users need to open the parameter's tab that will trigger the query_
0 commit comments