Hello!I have this scenario,Lists of questions fetch from database and displays using List widget. I have to answer it one by one. My question is, how can I handle the answers from each question since I am displaying it with a list widget. Everytime I am answering one question it goes the same with another questions. I am not sure if I explained it correctly, but please see clip attached for reference. I understand this is happening because I am only using the same variable for the answers, so what do you suggest to use for this kind of scenario? Thank you in advance.
Hi RD,
I have made changes to your oml file. Please check it.
Thanks,
Vipin Yadav
Hi @RD.,
I watched your clip and noticed that you are using local variables to bind your textbox and other controls, which is why the same value appears in all controls. A better approach would be to bind each control to a list of structured data. This way, each control displays its respective value.
Could you please share your .oml file? I can then make the changes and show you how it's done.
Hello @Vipin Yadav , thanks for your response. Yes, exactly, I am using same variables for the answers within the list and that is where I am having the issues. I am not sure if I can share the oml but I'll try to duplicate it to my personal environment to be more specific.
Hello @Vipin Yadav , please see attached .oml for reference. Thanks.
Hello @Vipin Yadav , I think this works, thank you!
Hi
It seems like the issue you're facing is that all questions are sharing the same answer variable, so when you update one answer, it reflects on all the other questions. To resolve this issue, you need a way to store the answers for each question separately. Here’s how you can handle this scenario in OutSystems:
Solution:
You can use a List of structures to store the answers for each question separately. Here's a step-by-step approach to implement this:
Create a Structure:
Create a List of QuestionAnswer:
Binding the Answers to Each Question:
Updating the Answer:
Structure Definition:
Local Variable:
Display Answers:
Submit Answer:
Hello @Amit Jain , I believe this will also work, and I can use this idea for the future tasks. Thank you!