I am unable to use Page Variable (which has data set from a Data Variable) as the repeating data structure. But it does work with the “original” Data Variable, which has same content.
Should I be able to use that Data Variable as repeated data as well?
Is your Page Variable “Variable value type” a List? Also, is the “List item type” an Object? When I have my Page Variable setup this way it shows as available for the Repeat capabilities.
Hey @Steve_Stava,
I’m trying to do this exact thing but whenever I tap a new value the page variable gets replaced instead of the values being stored in a list in the page variable.
So I have a list of questions coming in via a data variable and they are in repeat on my page. The user will then select their answer to the questions and store this in a page variable, so when the user taps ‘save’ button, the values are sent into Xano as a list.
In my testing, I have set up an alert to show me the page variable as I answer each question. Whenever I tap a new answer the page variable appears to get overridden instead of adding to a list.
Would you have any advice on how to store page variables in a list when the items are in repeat?
Thanks,
Eoin
Not totally certain of your problem but I feel you should consider the WITH_ITEM formula which enables you to add new items to an existing list.
1 Like
Hi Fred,
Thanks for your reponse, this worked exactly as I was looking for, however I created a small bug and hoping you can help direct me to a fix.
You mentioned you weren’t exactly sure what the issue is so context first:
I’m building a journal in which users will answer 5 questions and the answers are multiple-choice. The questions and answers are displayed via a data variable from my back-end application (xano). So I’ve setup the container to hold the questions and answers and set this to repeat down the page. There is also a repeat running on the answer section to populate the 5 possible answers.
The user will tap their answers and the id of the answer is being stored correctly in the page variable as per your earlier answer.
However, if a user decides to change their answer to any 1 question by tapping a different option, then their first and second answers are both stored in the page variable and then the 2 answers to the same question are sent to the backend. The user would only have 1 answer to each question.
So if the user changes the answer to the question I would like the page variable to ‘drop’ the previous answer and replace that value with the new value in the page variable.
Is there a formula within Appgyver that can do this. I suspect there is something to do with the IF function to make this work.
Thanks in advance for any assistance you can provide.
The formula to remove an item from the list is WITHOUT_ITEM
However I don’t have the solution for your answer options to act like radio buttons (only one active possible), but I saw posts about it in the past…
1 Like
Thanks Fred, Radio buttons was exactly the term I needed. I’ve found a guide on the forum to create them.
Thanks again for your help, much appreciated
Linking the guide on radio buttons here for anyone needing this in future
Eoin
1 Like