List of lists from csv


This is Taifuns original quiz, which I am trying to use for my project. I want to use the same quiz, but I want to bring my questions and answers from a csv for convenience.


Here is where I am at. This is working fine actually..
But I want to automate the "making" of the lisA list. Any formula , using a loop, and increments.

I hope I have stated the problem clearly. if not let me know.

listA could be a table in csv format like this

42,0,99,123456
10,8,12,4
1997,1984,2014,2999

read it using the file component and convert it into a list of lists using the list from csv table block

in the File.GotText event:
set global listA to list from csv table text

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like

Sir,

I made the csv as you suggested (in a column format) and in
File.GotText event I,
set global listA to list from csv table text

BUT, in this case, all the values(answers) always get populated in button1, always for each question.
i.e 42,0,99,12345 are all seen in button1. They dont seperate and appear in the four buttons.


When I do it as in the second image, the quiz works fine. i.e 42,0,99,123456 all appear in seperate buttons randomly.

please provide a screenshot of your updated blocks
and use the blocks from my example to get the answers random

Taifun

the rest of the blocks are just yours, i.e the original block.

after looking at your screenshot it looks like you did not define your file correctly...
it should look like this

you might want to add it into this thread

use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

1 Like

sir,
I got it. its working now.
I saw you comment and saw this
42,0,99,123456
10,8,12,4
1997,1984,2014,2999

but when I opened my csv in notepad, it looked like this.

"42,0,99,123456"
"10,8,12,4"
"1997,1984,2014,2999"

with " in the beginning and end.
I had saved it from excel, perhaps thats why.
I removed the " s from the notepad and saved it again as csv. uploaded it. and its working fine . WOW. i am so happy . Thank you Thank you Thank you.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.