dashjoin / platform

Dashjoin Is an Open Source & Cloud Native Low Code Development and Integration Platform that helps teams deliver applications faster 🚀 Uses a data-driven approach inspired by Linked Data to make use of your existing assets
https://dashjoin.com
GNU Affero General Public License v3.0
89 stars 7 forks source link

Input fields - Expression to generate options, does not "know" variables #371

Closed pgrill79 closed 1 week ago

pgrill79 commented 2 weeks ago

To generate the input options for an input field i use this expression: ( $query($.variable.db, "q_client_getSpecies", {"clientId":"92b4f138-c1d9-45c1-ae82-a6775a2657c3"}).species )

$.variable.db is set to our database (wooltest) - and the preview also works well: image

But when you save, the input shows: image

If you hardcode the database: ( $query("wooltest", "q_client_getSpecies", {"clientId":"92b4f138-c1d9-45c1-ae82-a6775a2657c3"}).species )

it works.

It seems that the context is not passed, because also if i execute this in the preview:

image

you see two results, but when saving, the choices are empty:

image

If you "Hardcode" the client Id - it works.

aeberhart commented 2 weeks ago

we were missing the expression context in the REST call, so user, variable, href etc. were not set

pgrill79 commented 1 week ago

It seems mostly to be fixed

This works now: $species:=$number($.variable.species); $call("json_replaceKey", {"data": $all($.variable.db, "breed")[fk_species=$species], "search": "id", "new":"value"});

Also this works $call("json_replaceKey", {"data": $all($.variable.db, "breed")[fk_species=3], "search": "id", "new":"value"});

For some reason it does not work if i use the variable in the pedicate query: $call("json_replaceKey", {"data": $all($.variable.db, "breed")[fk_species=$number($.variable.species)], "search": "id", "new":"value"});

in that case i get null. i have to assign it in advance to another "local" variable. as seen in the first example

aeberhart commented 1 week ago

Good catch - this has a different root cause in the jsonata implementation: https://github.com/dashjoin/jsonata-java/issues/45

closing this issue

we track the jsonata update here: #384