Ezra Epriputra

unread,
Mar 23, 2019, 12:20:15 PM3/23/19
to MIT App Inventor Forum
If i have db from spreadsheet then i going to show in list view.Is it possible to filter list from csv format, then show in listview, but the filter process not in the spreadsheet but in the app inventor using blocks? I already read about list of list a list but never see the tutorial about that if there any. Maybe someone know this...

TimAI2

unread,
Mar 23, 2019, 12:51:07 PM3/23/19
to MIT App Inventor Forum
Do you want to filter in the spreadsheet and not in the app?

Ezra Epriputra

unread,
Mar 23, 2019, 12:52:41 PM3/23/19
to MIT App Inventor Forum
Noo...i want to filter on app...not in the spreadsheet

TimAI2

unread,
Mar 23, 2019, 12:55:00 PM3/23/19
to MIT App Inventor Forum
What is in your table (provide example) ?
How do you want to filter, by which fields / content / etc. ?
What is to happen once the filtered list is put in a listview (e.g. after Picking) ?

TimAI2

unread,
Mar 23, 2019, 1:38:53 PM3/23/19
to mitappinv...@googlegroups.com
Here is an example.

The table.csv contains a list of lists, on item in each list is a colour
We grab the colours and put these into a Spinner
After selecting a colour with the spinner the listview
is returned with only those names that have that colour

aia attached

SCREEN

screenfilterlistbycolour.png


BLOCKS


blocksfilterlistbycolour.png



FilterListToListview.aia

Ezra Epriputra

unread,
Mar 24, 2019, 9:18:31 AM3/24/19
to mitappinv...@googlegroups.com
thanks for your aia...its help me alot...

this is my example

this is my table from spreadsheet

Untitled.png


This is my Block for Screen 2 and 3

Block Screen2.png

BockScreen3.png

This is My Result

WhatsApp Image 2019-03-24 at 19.51.03.jpeg

WhatsApp Image 2019-03-24 at 19.51.03(1).jpeg


When i choose after pick from selection index..the index is not match with the data view in listview...maybe because on the block i still refer to variabel "global member' at the after pick listview block

i have already to change it but im stuck and confused. can you help me with this? i want after that filter, after pick always match with the listview.


thanks



TimAI2

unread,
Mar 24, 2019, 12:45:40 PM3/24/19
to MIT App Inventor Forum
Don't understand the problem, it all seems to follow through..

You pick users
Listview displays "users"
You pick on of the "users"
Returns all details about that user

??

Ezra Epriputra

unread,
Mar 24, 2019, 6:52:50 PM3/24/19
to mitappinv...@googlegroups.com
it's not...
i will show you...this is same block as it is...
see my attached video...
when i open selvy its Brandon
when i open ronald its Edi
WhatsApp Video 2019-03-25 at 05.50.06.mp4

TimAI2

unread,
Mar 24, 2019, 7:51:29 PM3/24/19
to MIT App Inventor Forum
The problem is here:

blocksdifferentlists.png

You use the filtered shorter list index for the original longer list


What you will need to do is either add all the items (name, classification, car, hob) from the inputList for each match to the listviewlist and then replace global Member with Listview1.Elements (light green block)

or create another global list below listviewlist that has all the filtered items with all the original list items(name, classification, car, hob) in it, then use that as the list to replace global member


Ezra Epriputra

unread,
Mar 24, 2019, 10:07:35 PM3/24/19
to mitappinv...@googlegroups.com
can you help me with the block?
im little bit confused...
im attached the aia for you
thanks
example.aia

TimAI2

unread,
Mar 25, 2019, 12:41:12 PM3/25/19
to MIT App Inventor Forum
Here you are (see aia attached)

You will see on Screen 2 I have added a new variable for a list: FilteredMember
and this is added to in the same way as the listview1 list based upon "user" type
This means that both of these lists will have aligned indexes
I replaced "global Member" with "global FilteredMember" for the start value

You will see that the results on Screen 3 now match the selection on Screen 2

Not sure why you will need more than one screen for this though, please read below and look at the examples (e.g. Tabbed Screen Demo) for ideas:

Use different screens wisely

If you decided to use different screens, then you should switch them correctly, else you will run out of memory after a while...      
The recommended method of switching screens in App Inventor
(Thanks Taifun)

Also see demo: multiscreen.aia

If you haven't done it already....

ezraexample1.aia
Reply all
Reply to author
Forward
0 new messages