This feels like it should be simple but I can’t find a way to do it using wappler’s formatters.
I have a dynamic form builder,. There are a range of question types, input, select, multi select etc. For the select and multi select I want to be able to offer a choice of data source. Some of these are fixed, some are based on a custom list source. On creating the form field the data source selection is made from a dropdown. I want to use the selected value text as the path to the source for the select input, so it might be queryProgrammes or queryUsers as the value for example.
In the input below I want to be able to change queryChoice to the value text returned for each question without having to chain a long list of ternaries (so the data source is scUser.data.queryProgrammes
or scUser.data.queryUsers
based on the data source selected, the list of options would be much longer).
<input class="w-100" is="dmx-tagify" id="tagify1" name="tagify1" noinput="true" nocustom="true" min-chars="0" dmx-bind:data="source.startsWith('SET')?scUser.data.queryChoice:scUser.data.queryLists.where(`list_type_id`, source, '==')" tag-text="text" noautocomplete="true" dmx-bind:placeholder="type" tag-value="value">
So scUser.data contains a number of queries, I can list all the queries using keys. Can i dynamically pick a key and return the data under that key? Something like:
scUser.data.where(`key`, source, '==')
It feels like it should be quite simple, but I can’t see a way to do it!