Choice components and choice dependent answers

Hello Folks,

Need some help with finding an easier way to do the below and also something that is lesser error prone.

Use case: The requirement is to have the user pick a question from a dropdown and then respond to it.

I am making use of Choice component to list out the questions. I have also built out a column corresponding to each question to display it when the user select the question and store the answer to it there.

In my case, there are 7 questions in the Choice component and hence 7 columns for storing the answers to the selected question. Now for each choice picked, I have to add 7 different text entry fields which are conditionally mapped to the corresponding choice picked. So in total, I have to add 49 fields conditionally mapped to the choices.

I am expecting the choice options to increase to 12. Doing this approach, would make me manually add 144 fields and conditions to them. This could be very error prone as I am seeing it while building solution for just 7 choice options.

Has anyone tried anything similar with a simpler approach? Using relations or other aspects?

Below is the video showcasing the problem.

***If you need more information to understand this better, please let me know.

How do you end up displaying the results? To me it seems like it would be simpler to have only one answer column for each question column. Then wherever you display those answers in your app, you can just display the question column for the title and the answer column for the answer.

The problem is, I don’t want to populate the page with all the questions. Only if user chooses to add details (in this case about the pet), then they can add it.

What I’m saying is, instead of 7 answer columns for each question, you would only need 7 question columns and 7 answer columns total. You can still conditionally show each answer component depending on if they selected a question or not. Basically, instead of having specific columns in your sheet for each answer, they would just be generic answer columns (Answer 1, Answer 2, Answer 3, etc). Same with the questions (Question 1, Question 2, Question 3, etc).

The reason I ask how you are displaying it is because glide will only show text components that have a value in the column, so you can add all of the answer columns as text components on the display screen, but set the title of that text component to the corresponding question column value. Seems to me like that would be a whole lot simpler. Then if you ever needed to add another question in the form, you only need to add one question choice component and one answer text entry component on the screen. You don’t have to touch any of the prior question and answer components at all.

1 Like

There are just 7 columns for the answer.

Hmmm… I have just made 7 columns.

Doing this:

It would still require me to add all 7 text fields per choice. May be I can do something different on conditions to make it work as you are suggesting.

Hey @Jeff_Hager,

I got what you are saying. Basically I don’t need to name the answer columns with question at all. Just another array for answers would do. Confirming that this works.

Thank you!

1 Like