How do I convert list from csv row to nested list?

279 views
Skip to first unread message

Goel Biju

unread,
Mar 2, 2015, 6:45:20 AM3/2/15
to mitappinv...@googlegroups.com
Hello,

I am just asking on how I can turn my value from TinyWebDB, which is sent to a list from csv row, into a nested list?


Ghica

unread,
Mar 2, 2015, 8:49:18 AM3/2/15
to mitappinv...@googlegroups.com
Hi,
You need to give a bit more information, like an example.
Look also at: list from csv row , list from csv table here: http://appinventor.mit.edu/explore/ai2/support/blocks/lists.html
Cheers, Ghica.

SteveJG

unread,
Mar 2, 2015, 8:53:40 AM3/2/15
to mitappinv...@googlegroups.com

Goel Biju

unread,
Mar 9, 2015, 12:22:45 PM3/9/15
to mitappinv...@googlegroups.com

 

Hello,

Sorry for the lack of clarity in my question but I have posted screenshots of the value from the TinyWebDB and what this value is converted to by using list from csv row. I have posted my original nested list so you can see what the final structure of the converted list should be.


So basically what I want the program to do is when the value from the TinyWebDB is fetched it needs to be converted to a form of the original nested list so the current program can work. Since there is no function in AppInventor that can do that, I have decided to convert it to a list from csv row. I need to know now how I
can change this list into the original structure of the nested list.

The original nested list, this is how the values from the TinyWebDB should fit into at the end; the values include the Subject, Number of Computers available currently and the maximum number of computers available, respectively. 



This is the part of the program that deals with retrieving the TinyWebDB values and turning them into the list:




This is the value received straight from the TinyWebDB:

This is when the list to csv row function has been used to create a single list from the TinyWebDB value:







So far the program can fetch from the database and then convert the TinyWebDb value into a list from csv row, this list is stored in temp_list and now I need to organise it into its original nested structure into a list called test_list. The organising should call upon the procedure called Build_List and in this procedure should be a for loop or a loop which can place the items from the temp_list into the correct format into the test_list.

I think a For Loop needs to be used in order for the program to work:




Thank you,

Goel


Taifun

unread,
Mar 9, 2015, 1:28:44 PM3/9/15
to mitappinv...@googlegroups.com
I have posted screenshots of the value from the TinyWebDB and what this value is converted to by using list from csv row. 
why are you using the list from csv block?
how do you store the list in TinyWebDB?
if you just store the list as it is (list of lists), you can retrieve it again as it is (list of lists) without need to convert anything

see also

Taifun

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


Jen H

unread,
Mar 9, 2015, 1:30:57 PM3/9/15
to mitappinv...@googlegroups.com
you could try something like this maybe..https://groups.google.com/forum/#!searchin/mitappinventortest/make$20a$20list$20of$20pairs/mitappinventortest/7me17jNuEac/dpmuz2J4zYcJ
just add a 3rd input to make a list of 3 items instead 

Goel Biju

unread,
Mar 11, 2015, 5:35:51 AM3/11/15
to mitappinv...@googlegroups.com
Thank you very much! I have just realised that the code works without the need to convert the list into a csv row, the code was stored in the csv row form in the TinyWebDB. The retrieve works now, so thank you very much, I had not realised the common sense method until now.

Goel

Goel Biju

unread,
Mar 11, 2015, 5:36:39 AM3/11/15
to mitappinv...@googlegroups.com
Thanks to all the people who replied as well. Thank you!

Goel
Reply all
Reply to author
Forward
0 new messages