Validity of the lists

Hello,
I would like to know what is the validity of the variables lists; for example if I create a list inside a procedure … this has no validity inside another.

I initialize the variable with “empty list” and then call a procedure that fills the list and then again I would like to use it in another … ex. “Screen Open”.

Andrea

Set up this way, you can use the list variable (myList) in other blocks and other screens as well:

Screen Shot 2019-12-29 at 9.27.58 AM

Hello,
I created my blocks in the same way as you can see but the lenght of my list when I printed is equal to zero.
your right, if i replace the spreadsheet block with a static list as in your example works fine … maybe is my airtable blocks?
Thanks
Andrea

Hi @Andrea_Marchisio,

I can see that you set the View Name of your spreadsheet before retrieving any values in your myList function.
Can you try setting the View Name of your spreadsheet in the Properties window of the spreadsheet components?

For actually compiling the list, your current blocks will create a single-item list that is the ‘Titulo’ property of the last row in your spreadsheet. I think what you’re trying to do is make a list of every ‘Titulo’ property in your list, correct?

You could do this more easily using the Spreadsheet’s ‘Get Column’ block, then setting ‘link_articolo’ to the list you retrieve.

In general, the block you use to append a value to a list is ‘in list [LIST] insert at [POSITION] as [VALUE]’:

listinsert

Hello Jane,
today I realized that the problem was due to timing: when you open a window and call a procedure … the “open” block does not wait for it to be finished but continues with the rest; that’s why I never saw the enhancement of my list.
Just put a “Wait” block and now it’s ok.

image

Now just to complete my procedure … I have to insert the data but multidimensional … in a static way it’s simple as follow but with dinamic data no.
What do you advice me?

Thanks
Andrea

image

1 Like

Hi Andrea,

Regarding your myList function: I’m glad this works for you! I’ll just point out that, since you’re using a ‘set list’ block rather than a ‘append to list’ block, you don’t need to include the ‘count with x from…’ block. It just means that you’re calling the same ‘set list’ block multiple times.

These blocks will be fine as long as you will only ever have 2 rows in your spreadsheet. If you want your blocks to be more flexible and be able to call more/fewer values in the future, try one of the methods in my previous comment. I’d be happy to give advice on either one!

Regarding your multi-dimensional list, what you’ve done is exactly right. This will provide the list [[AAA,BBB,CCC],[DDD,EEE,FFF],[GGG,HHH,WWW]].

Jane