Skip to first unread message

Mc Woodhouse

unread,
May 30, 2016, 10:52:55 PM5/30/16
to MIT App Inventor Forum
I get the following response from the web1 GotText component. 

I set a label to the response and I see this.

1) TAG147, 999999999, 1000, 1000, 999999999, 1 
2) cdrw12, 123456789, 1000, 1000, 123455789, 1 
3) Dad737, 123456789, 1000, 1000, 123455789, 1

I do not want to show all of the CSV's how do I sort/filter out what I do not want?

Also why did the label put each row on a separate line? I thought it would be all on one line.


Blocks.PNG

Ghica

unread,
May 31, 2016, 8:46:04 AM5/31/16
to MIT App Inventor Forum
You see the result on several lines because you received several lines.
How to sort this out, depends on what you want. You could convert your response content to a list of lists using "list from csv table text (your response content)". Then, go through the list using one of the "for each" blocks, and put what you need in some global variable, which you then display.

Some pointers to using lists:
List Blocks, by Sajal Dutta:
http://www.imagnity.com/tutorials/app-inventor/list-blocks-on-app-inventor/

Chapter 19 of the App Inventor book:
http://www.appinventor.org/bookChapters/chapter19.pdf

Displaying a list:
http://ai2.appinventor.mit.edu/reference/other/displaylist.html

Cheers, Ghica.


Taifun

unread,
May 31, 2016, 8:46:07 AM5/31/16
to mitappinv...@googlegroups.com
what you are receiving is a table in csv format... the delimiter for each item is a comma, the delimiter of each row is the invisble new line character \n

usually you convert the csv table into a list using the list from csv table block

sorting/filtering lists is no simple task... it would be easier to filter/sort before receiving the data on server side
you can find solutions about filtering/sorting lists after doing a search here in the forum

see also

Taifun

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

Abraham Getzler

unread,
May 31, 2016, 10:45:57 AM5/31/16
to MIT App Inventor Forum
Also see the SELECT and WHERE_EQ procedures in this Gallery app:

Mc Woodhouse

unread,
Jun 3, 2016, 5:22:19 PM6/3/16
to MIT App Inventor Forum
Thanks for the help! I was able to do what I wanted. I used the list from csv table text to save the response to a variable. I then used the  select list item list blocks to sort and display the list in a label. 
GotText.JPG
Reply all
Reply to author
Forward
0 new messages