List of list from csv


The first image is a sample of my csv. Each record, in turn is a list of 3 items.

ScreenClip1
The second image is how I am creating my list .

I need help with:
If I have a 100 records in my csv, in my above method I will painfully repeat the process 100 times, typing in the index number each time till 100.

How can I program it so that, the index number for each record in the listAnswers increments automatically? Or that listAnswers is made with the power of programming as opposed to manually doing it for each record.

ps : I am an indian classical arts teacher for small children. I dont know CS concepts. I discovered AI2 and now I am hooked. I am completely new to programming stuff.

The structure of your csv is not very clear, please show it as text, not excel.
Instead of using LIST FROM CSV ROW try LIST FROM CSV TABLE, then a FOR cycle to find items

1 Like

You would find it easier to work with lists of lists if in this format:

a,b,c   << line return
d,e,f   << line return
g,h,i

commas separated values in a row, then then next row in a column, to make a table. This is then easily interpreted by AI2 in its list object.

Learn about using lists:

General Tutorials

1 Like

This is a well documented quiz sample, but it lacks file loading for the questions and answers ...
https://puravidaapps.com/quiz.php

2 Likes

It's a great quiz. Taifun is a hero of mine.

But, yeah I wanted to do the same structure with CSV and automating the making of list of list process instead of using literally 100's of blocks to make a list of say 100 questions.

I am trying a few things. None working so far, but enjoying this process.

Here's a sample 6 column (Q,A,A1,A2,A3,A4) csv table that should be simple to load and use ...

"What color was George Washington's white horse?",white,grey, palomino,black,white
"What color are AI2 list blocks?","light blue",green,red,blue,"light blue"
"The C in CSV stands for",comma,"the C language","camelCase, "its inventor's initials", comma
...

I deviated from Taifun's 5 column scheme to avoid having to randomize the answer choices on presentation.

2 Likes

Thanks. Yes this is an idea I had have tried.
Nice quetions :smiley:

Hello Sir,

I dont mean to distrub you. I am trying but cannot solve a problem.

  1. Inspired by your quiz app, I am trying to make the answer list from a csv file. if the quiz has a 100 questions and 300 possible answers then it may better to use a csv.

i made a csv - "a,b,c","d,e,f", "g,h,i".... each alphabet are answer options, the first one being the answer.
I imported this file in app inventor. I mad a mainList which contains all answers from each question (a,b,c) in one record. so in mainList index 1 is a,b,c. Index 2 is d,ef and so on.

I am failing to automatically make a listAnswers whis a list of list from mainLIst. I can do it manually, by adding blocks.

  1. Is it possible to make the button clicked which had the correct answer to change color to green if correct or red if not and then reset it to default grey when next question appears.

Many thanks. No hurry.

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


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

Maybe you need to see how to load a table from a Media file? See

1 Like

Woow, I am just amazed at how many apps are there. I am going to need a year to process all of that. Its likea a goldmine. Thanks.

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