Use listpicker to identify and use the correct list

Hi,

Hoping for a little help. I have a multitude of lists, I am trying to use listpicker to identify which list to use based on selection. To that end I get the selection and store in in a global as text, that selection is the name of the list.

I am then trying to open the list in order to iterate through it. Despite the global being an identifier for the list name, when running the app of course it fails, because the global is a string an not a list.

So how can I make a listpicker selection act as a pointer for a list?

Below is a screenshot of the applicable section. On click of a button global temp is set to the "from_loc" listpicker selection (the name of the list I want). Time is initially the current time and is the number compared in each list (next bus). The second piece deals with bus arrival time, but also wont work because I am reusing the global temp from another listpicker selection to also try and id a list to look through (Next Bus and Arrival time at the desired location)

image

After I type this I realize that a list of lists might be the way to go? That way it would just be a static list where I compare the listpicker selection to each list within the one list to find the correct list to test. Not quite sure how to go about creating a list of lists with ai2 though.

Quick example:

You do have to keep things in order :wink:

If you want to "label" your lists a masterList:

image

There are other ways to do this....

I saw where you were going before the edit, very clever having one list be the data in multiple lists then using another list with the names of each section as the index for it. Provided the names in the listpicker match, in order, with the names list you can use the index of the listpicker and the names list provides another index for the real goal; the data

Did up a small test and it seems to be working perfectly!

Maybe its just me but python and even to some extent C++ are somehow more intuitive/easier (not that I am fantastic in those either :stuck_out_tongue:

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