can the contents of a random row of a table be displayed in a NOTE?
thanks for helping!!
can the contents of a random row of a table be displayed in a NOTE?
thanks for helping!!
Yes, but not simply. For only numeric content, you can create a numeric list in a graph (hidden if needed), then set a variable using the random function in the graph and display that number in the note.
If not numeric content, you would need a when-when-… otherwise statement set to each cell determined by a number chosen using the random number generator in the CL. Neither is super clean and simple, but it’s possible.
So if my table already has the following:
QUESTION ANSWER
Question1 Answer1
Question2 Answer2
Question3 Answer3
And let’s say a = 2 (2nd row) Can you help with the code to show content of row 2 into the note? thanks (My table has 2 columns and multiple rows)
In your note CL
T=tableName #change to the name of your table
r=randomGenerator()
lastRow= 10
q= r.int(1,lastRow)
questionText= when q=1 T.cellContent(1,1)
when q=2 T.cellContent(2,1)
when q=3 T.cellContent(3,1)
when ....etc
otherwise defaultText here
answerText= when q=1 T.cellContent(1,2)
when q=2 T.cellContent(2,2)
when q=3 T.cellContent(3,2)
when ....etc
otherwise defaultText here
Then, use the {#} button in the main field where you type your note content and choose questionText where you want that text to appear.
Awesome thanks. I will definitely give it a try