It is used in the form in the document I attach below:
And it is intended to randomly pick a question from a table of questions. At the moment it doesn’t return anything and I would ask someone to help me with this issue.
I can’t see your doc, but I notice the following:
if Randomize is a checkbox, you don’t have to add ‘= true’.
I think you should not use Lookup, but just RandomItem(ListOfQuestions)
I honestly don’t understand what you are trying to do - the form can work, but the question should become dependent on the category, but that also has the random formula in it. You probably want to filter the question based on the random category, but by the time it evaluates your formula, the category has not been filled yet.
So you really have to try something else - which is possible.
To answer your actual question - change the formula (for the question) to:
if(Randomize, RandomItem(Questions.Question), "")
When you hit the switch, the question will fill with a random choice from your table.
edit: changed the formula, it didn’t have the correct CFL
Thank you for the response. I will clarify what I want to do:
I have a form, and I would like that when I press the randomize switch, a random category from the questions table appears in the category section. Considering that for a single category there are multiple questions, I would also like a random question from that category to be chosen at the same time, based on the randomly selected category. That’s why I used lookup. For example, if category 2 is randomly chosen, you can see in that table that there are 3 questions in category 2, and I would like one random question to be selected from those 3.
I understand what you are trying to do, but the way you have setup your answer table, you only have to make one random choice. The random choice of a ROW will include a category and a question.
That said, to make your current config work, you need the following two formulas
I think you are not using the correct Category columns - you have to check while typing what the options are and pick the right one, although Coda will often help:
Oh yeah, I see, thank you, I will try your tip and I will come back with an update. In the meantime, thank you very much for your help, you really helped me.