Orbit
1
Hello Bubble,
Im currently building a puzzle quiz:
and I have the following data fields to the data type puzzles (the correct answers fields is just me trying to figure it out without luck, i have tried using the image path as a correct answer but no luck:
Issue:
The issue I’m having now is how do I set the image to be the correct image answer?
I 'm trying to achieve the following structure: they select one image, if they select another one the past one gets unselected (i assume with a state but not sure how to execute that). And then they click on a button that says “Submit answer” and it checks if the selected image is the correct image answer.
Thankful for any guidance 
Are you sure the answers will consist of images? For some questions, might it be necessary to include an explanation text for each option?
Orbit
4
Yes, that is the question data filed
why not set the answer to number such as 1,2,3,4 base on count of images you have as the option
So if you have 4 image, set the answer to 3 that’s mean image:item#3 is the answer.
For the select unselect state u could use a custom state to hold temporary variable and then if custom state is not current item index deselect
Edit : english is hard
1 Like
Orbit
6
Thanks for your input! Reason why i can not have number (at least what i think) is that i will show them randomly in the repeating group and not in order.
But maybe the order is in the actual way i upload them to the data filed?
hergin
7
If your list of answers is a list of images, and your correct answer is again an image, you may not achieve this the right way. Because the image you uploaded as the correct answer might not be (and probably will not be) in the list of answers (even if it perfect is the same picture). Technically, you should have an Answer data type to do this clearly. The logic is, you can mark one of the answers as the correct answer, and then you can check if the selected answer in the repeating group is the correct answer, easily.
1 Like
Orbit
8
Hey, thanks for your comment! But how do i mark it as correct?
hergin
9
I don’t know how many questions you have but you will either do it in a basic dashboard for the admins (show all the questions and their answers and mark as correct button in each cell).
Or you can use the data tab of the editor, to do this manually yourself.
Orbit
10
Is it possible that you can show me how to do it in the editor/data base?
Hmm other idea for a randomize case is prob make your data structure change
example. so you have an image table called “pattern” where you put countless of image (single item sadly)
And then on the current table you working on just assign a relation table into the “pattern” for answer is a single item and for the option just “list of pattern”
Now to check for the anwer if it’s correct you just filtered it out maybe use count after that if it’s return 0 then it’s incorrect return 1 it’s correct
Rough idea:
Orbit
12
Not sure on this one? What is image_data? and how do i connect the correct awnser to the correct image? Im sorry if i dont understand but this is for sure the most confusing thing i have tried to built so far haha…
Image_data is just a name for a table.
Basically I suggesting you to create a relationship table a one to many relation
So there will be 2 table (1 quiz A and 1 for images B)
All u need to do on table A is to add table B value to quiz_answer and quiz_option list (the value it saved will be unique’id)
And so like i said with custom state before. Make a custom state with the type of table B. When user click on one of the image in the quiz_option save it to the custom state.
Now to check if the answer is correct you use “do a search for” with filter “custom_state’value is table_A’quiz_answer”
hergin
14
Here is a little sample for you for a basic dashboard:

You can check the details right here in the editor: Tests for Forum 14 | Bubble Editor
To change those in the editor, you can go to your data and edit all fields. Of course, you need to know which image is which in this case:

2 Likes
Thankyou for the further explanation 
Orbit
16
Thank you so much @hergin was this insane detail of explanation!! Is it possible to show the Repeating group and workflow to set the correct answer? 
Edit: Just saw the editor you shared
Orbit
17
So it is not possible to have the question and answers in the same data type? Like i have:
hergin
18
Possible but separate makes more sense and makes it easier and more maintainable and extendable.
1 Like
Orbit
19
Ah i see, thank you so much, i will go with your example!! 
system
Closed
20
This topic was automatically closed after 70 days. New replies are no longer allowed.