Assign query results on client side

I would like some advice how to best approach a relative simple challenge.

I have a table like this:

+------------+----------+
| QuestionID |  Answer  |
+------------+----------+
|          1 | Answer 1 |
|          2 | Answer 2 |
|          3 | Answer 3 |
+------------+----------+

I load this on client side by using a serverconnect named “get_answers”.

Then I am displaying these in inputs by using the index [0], [1], etc. of the query:

<input type="text" dmx-bind:value="get_answers.data.query1[0].Answer">
<input type="text" dmx-bind:value="get_answers.data.query1[1].Answer">
etc.

However, when one question is skipped, for example QuestionID 2 is not filled out, the wrong answer will be listed.

Is there a way to bind the answers based on the QuestionID column?

Something along the lines of:

Answer 1=<input type="text" dmx-bind:value="get_answers.data.query1.Answer where QuestionID=1">
Answer 2=<input type="text" dmx-bind:value="get_answers.data.query1.Answer where QuestionID=2">

I’d rather not use GET on the server side, so ideally do some sort of assignment on the client side.

Is this possible?

Community Page
Last updated: