Picking a list whose name comes from a text variable

I have a list that contains six topics, and each topic has its own set of questions, resulting in six lists of questions. When a topic is picked randomly, the name of that topic is stored in a text variable. How can I access the list that corresponds to the name stored in that variable?

From your previous topic "Maybe show your relevant blocks..."

It is always good to show as much relevant info as possible.

I haven't got any blocks to show. I tried around, but I can't get the text with the name to be recognised as a list that already exists.
This does not work:


LCurrentAnswers1 is an empty list. In the variable In TTopic is the name of the list I want to pick.
Initially, I attempted to copy the list using the name stored in the variable TTopics. However, the text in that variable is not recognized as the name of a list. Then, I tried the approach shown in the image above, but I encountered the same issue: the text needs to be interpreted as the name of an existing list.

Ok. I will try to use an if-function somehow.

This is the table (list of lists) based way to organize the topics and questions.

  • multicolumn table, one row per question, with these columns:
    • topic (History)
    • question (What color was George Washington's white horse?)
    • answer (white)
    • fakeChoice1 (palomino)
    • fakeChoice2 (unicorn)
    • fakeChoice3 (Clydesdale)

This lets you filter the table using advanced list blocks to extract sub tables of questions belonging to just one particular topic.

Use a .CSV file or spreadsheet to load questions, to avoid block clutter.

1 Like

You can use a dictionary to link each topic name to its corresponding list of questions. When you get the topic name from your variable, simply look it up in the dictionary to access the correct list. This way, you can easily manage the lists without any issues.

1 Like

quick example: