Database. Tag with multiple data

Hi there,
Im new to programing. Im trying to do a simple quiz app. Im stuck on one problem:
I have an excel file with questions (over 450 questions), 1st column with no. of question, 2nd actual question, 3-6th ABCD answers, 7th correct answer, 8th explenation of answer.
So, I have a basic idea how to make it work, with one question - by adding data manually. Unfortunately, its not possible for over 400 questions.
How to upload a database with all of my questions, so I can call all of the columns for one row - based on a variable (first column, with question number).

Which MIT App inventor tool should I use?
Maybe I need an additional tool for database managment?

Welcome Grzegorz.

This tutorial shows one way to make a quiz using lists App Inventor Tutorials and Examples: Advanced Features | Pura Vida Apps .

It gives you a possible starting point. Lists can be saved as Tags in FirebaseDB and CloudDB. You have more database options too that are more complex ( see Multiple choice quiz retrieving questions and answers from google sheets or csv - #3 by TIMAI2 ) to get some ideas.

Here are some resources to help you learn to use the AI2 tools. A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook http://www.appinventor.org/book2 ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.

There is a free programming course here http://www.appinventor.org/content/CourseInABox/Intro and the aia files for the projects in the book are here: http://www.appinventor.org/bookFiles

How to do a lot of basic things with App Inventor are described here: http://www.appinventor.org/content/howDoYou/eventHandling .

Also look here App inventor español. Offline. Tutorial. Ejemplos. Instalación. Códigos. Juegos. Curso gratis de App inventor. and here Tutorial Index | imagnity for more tutorials

Learn about components Component Reference
and visit the Library The MIT App Inventor Library: Documentation & Support Help>Library on the MENU

2 Likes

Thanks a lot.

1 Like

Hi,
I've done what I wanted. It works for a small amount of questions, but when I load full data I get an error.


Im sure there is a better way to do it, but I just cant figure it out. I think my way gets me stuck because of some limits for .csv or sings in a string. I don't know. Would be greatfull for some advice.

Please show an example of 3 or 4 questions, and the format in text when reading the file.

Everything in the for each loops is wrong.

You built your question and answer rows in the csv table conversion step.

Read the quiz examples given to you already to see how to pick the next question and present it to the user.

I've try to find the answer in tutorials. There is a lot to refering googlesheets. Nothing about local .csv
How can I refer to that?

I have this:
image
I doesn't work.

NOTE: My .csv is not comma seperated, but ; seperated. (I use , inside cells).
My data looks like this:

CSV files are only for dead storage and transport of data.

If you are working locally, you need to transform the dead csv text into lists and tables to allow use of list blocks like SELECT ITEM n FROM list.

Since you are using ';' as a column delimiter, and since you probably have extra commas imbedded in your cells, you will need to convert your text file contents into a table (list of lists) in two steps:

  • split the text at \n to get a list of text rows
  • loop through the list of text rows splitting that row at ';' to get a new list, adding the new list as an item to an empty list of lists (table.)

By the way, AI2 has no native SQL support (unless you want to invest in a SQL extension.)

P.S. Here is a sample project to do SQL-like SELECTs on a table (list of lists)

Ok. I've done exacly that below and it works with a couple of questions, but with 500 it doesnt't.


There must be something wrong with my .csv file, right?
Or maybe there is a character limit to a variable, so my "list from csv table tex" does not work?

I would rather make a local file, so there will be no need for internet connection. But now i think I have to go with google sheets.

No, you haven't.

Please download and post each of those event block(s)/procedures here ...
(sample video)





global questionrow
global questionno

global fullfile_as_text

These draggable blocks split your (not really)csv file in two phases:

  • split into rows at the gotText by \n
  • split each question row into parts in refresh procedure, as needed by questionno.

(The screen initialize event is OK as is)

Thank you. It works great...
but there is another problem. Some of the cells also have /n in them. I thought /r/n was a solution, but It seems it was causing a problem in the first place (with my fist blocks aka. "the walkaround").
Any ideas how to correct that?

Ok. I've added VC15 (as a tribute to VInce Carter) to the last column in .csv file and changed
image
Another wolkaround, but it works fine. If you have any other ideas please let me know.
Thanks again.

Rename the file suffix from .csv to .txt to avoid confusing any one else dealing with the file,
considering it does not have Comma Separated Values?

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