In short, this is the case:
- Im building a survey where each question has its own Option set for answers
- I want to build a custom dropdown so it fits my app’s styling
- The thing is, it feels unefficient to copy the custom dropown for each and every question (so each one would have it’s appropriate option set source)
Im trying to achieve something like this: A way to get the custom dropdown’s options set source to change by condition, so I could re-use the same one for all of the questions (instead of building a bunch of them…)
Just have one option set ‘Answers’ with an attribute for the Question, or a ‘Question Type’ if the questions are in DB. If questions are in DB, have a Question Type field on the question and display possible answers for that question using Option Set:filtered (filter by Question’s Question Type)
It’s occurred to me that the questions might not even be coded into the DB/Option sets in your case, in which case you can still use the Option Set:filtered as the drop-down data source and still use it conditionally.
That’s a great solution! love it.
I’m gonna try having just one Option set with an attribute for the type_of_question (which will be a seperate option set)
Then I will filter the options inside the seusable custom dropdown to only show the options of the relevant type
For future reference, it’s linguistically implied that you need a single option set.
Each question has answers. The question that the answer belongs to is a property of the answer. However, answers with different questions are both still answers. That means that Answer should be a option set/Thing and Question should be a field (property) of it.
Generally speaking if your database or option sets look like:
Question 1 Answers
Question 2 Answers
Question 3 Answers
You’ve made life hard for yourself, as ALL of those are answers (and should be a single data type / option set) - the question is just the property of the answer.
Ok that makes a lot of sense.
So Im gonna try it this way, with two option sets:
- Answers (where each answer has a field for Question)
Possibly better to have list of Answers on the Question too if lots of answers
Yeah for sure, gonna do it that way where the connect between the two is two directional