A Multiple Choice Quiz with Advanced Features

109 views
Skip to first unread message

Miguel Aretxabaleta

unread,
Mar 1, 2019, 11:51:59 AM3/1/19
to MIT App Inventor Forum
Hi there!

I've been following Taifun's post about doing a multiple choice quiz with advanced features (https://puravidaapps.com/quiz.php) and I have a problem: as you can see in the attached file, the block is getting to big to handle. I've tried converting it to CSV and loading it using a File component, but since it is a list of lists, I haven't figured out a way to do it and introduce it in the local variable (see attached file). Anyone could help me? Thanks in advance.
Captura de pantalla (618).png
Captura de pantalla (619).png

Taifun

unread,
Mar 1, 2019, 11:56:07 AM3/1/19
to mitappinv...@googlegroups.com
a list of lists is the same as a table, just store the answers in one row seperated by comma and for each question use a new line

example
11,12,13,14
21,22,23,24
31,32,33,34

then use the list from csv table block to convert the table into a list of lists

Taifun

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

TimAI2

unread,
Mar 1, 2019, 11:58:26 AM3/1/19
to MIT App Inventor Forum
Just build a table in google sheets with your data, don't worry about the empty columns to start with, deal with those when you import the data to a list variable and access them

ABG

unread,
Mar 1, 2019, 12:04:25 PM3/1/19
to MIT App Inventor Forum
Message has been deleted

Miguel Aretxabaleta

unread,
Mar 1, 2019, 12:07:46 PM3/1/19
to MIT App Inventor Forum
Thank you for the answer!

Miguel Aretxabaleta

unread,
Mar 2, 2019, 11:07:39 AM3/2/19
to MIT App Inventor Forum
Hi Tim, sorry to bother you again, but I didn't get to solve the problem. As you said, I built a table in google sheet and saved it as .CSV. The problem is that when I execute the NextQuestion procedure, the four values of the cell appear only in the first Button, this is, the four answers in the same button text. What should I do/change? (Attached is the .csv) Thanks in advance.
All.csv

TimAI2

unread,
Mar 2, 2019, 11:58:11 AM3/2/19
to MIT App Inventor Forum
You don't show your blocks on how you are loading the csv as a list ?

Miguel Aretxabaleta

unread,
Mar 2, 2019, 1:40:36 PM3/2/19
to MIT App Inventor Forum
I don't know why but no text is displayed now in the buttons, the error of copy list appears
Captura de pantalla (627).png

TimAI2

unread,
Mar 2, 2019, 1:46:40 PM3/2/19
to MIT App Inventor Forum
Still can't see how you are bringing in your csv file from those blocks

Also I see you are developing on thunkable, you really should be asking for help there rather than here.

Miguel Aretxabaleta

unread,
Mar 2, 2019, 2:04:31 PM3/2/19
to MIT App Inventor Forum
I'm using the File component to read the .csv (AllRow.csv) and storing it in TinyDB to send it to another screen.
AllRow.csv
Captura de pantalla (628).png

ABG

unread,
Mar 2, 2019, 2:06:17 PM3/2/19
to MIT App Inventor Forum
The All.csv file is bad.

The " marks are hiding the commas, which make the columns.

Remove the " marks from the csv file, or
redo how you enter your data into your spreadsheet to
use 4 columns, not just 1.

ABG

Capture.PNG

TimAI2

unread,
Mar 2, 2019, 2:09:19 PM3/2/19
to MIT App Inventor Forum
Allrows.csv: There is nothing wrong with the " but this should be a table not a row

Miguel Aretxabaleta

unread,
Mar 2, 2019, 2:11:50 PM3/2/19
to MIT App Inventor Forum
So should I save the google sheet as .tsv? Sorry if it is a stupid question.

Miguel Aretxabaleta

unread,
Mar 2, 2019, 3:16:11 PM3/2/19
to MIT App Inventor Forum
Finally solved it downloading the questions as a table in the format .tsv. Thank you for your time!

TimAI2

unread,
Mar 2, 2019, 5:01:05 PM3/2/19
to MIT App Inventor Forum
You could have still used csv but ensured the data for each question (four answers) was on a different row:

1,2,3,4
A,B,C,D
5,6,7,8
a,b,c,d

etc

ABG

unread,
Mar 3, 2019, 12:29:15 PM3/3/19
to MIT App Inventor Forum
@TimAI2's observation that a table conversion block is needed here is correct.
(I posted based solely on the Allrows.csv file contents, so I missed that.)

However, let me elaborate on the problem with the Allrows.csv file markup.

How many columns should there be in row 1 in the attachment?
You say 4, but AI2 sees just 1 column.

See attached, to see how the external " marks deactivated the
csv conversion block's treatment of the interior commas.

Had the " marks had interior closure, the commas would have been visible:
"a b","c d"
"e f","g h"
would have been recognized as having 2 columns, not just 1 column.


By the way, you say you successfully loaded a .tsv file.

Would you mind posting the ,tsv file and the blocks you used to convert it?
I haven't seen any one do that yet in this forum.

ABG

Capture.PNG

Miguel Aretxabaleta

unread,
Mar 3, 2019, 1:41:55 PM3/3/19
to MIT App Inventor Forum
Thank you for your insight @ABG, very interesting!

First, I loaded the .tsv archive (you can find it attached) as a File component, then I stored it in tinyDB. I don't know if it matters but I did this in Thunkable, so I'm not sure if it is applicable to App inventor.
A.tsv
Captura de pantalla (631).png
Captura de pantalla (630).png

TimAI2

unread,
Mar 3, 2019, 2:03:08 PM3/3/19
to MIT App Inventor Forum
That is a csv file structure :)

ABG

unread,
Mar 3, 2019, 2:18:01 PM3/3/19
to MIT App Inventor Forum
I love Notepad++, it shows the darkest secrets of text files.

I was under the impression that .tsv stood for Tab Separated Values, and
.csv stood for Comma Separated Values.

But NotePad++ shows commas, not \t tabs, between the columns,
so it's csv, not tsv.

This reminds me of the old Benny Hill joke ...

Benny Hill lovingly holds up a box of the laundry detergent Tide(R) to the camera
and announces ...

I wash my clothes inTide ...
and hang them up to dry outTide!

ABG



Capture.PNG
Reply all
Reply to author
Forward
0 new messages