list from table cell

I thought it would be really useful to be able to put a list of data in a table cell and retrieve it as a list. In effect it would make it so a table could have a 3rd dimension of data.

I made a function that will take the contents of a cell and if they are separated by commas it will create a list out of the items that can then be used in anyway lists are used… It will also test for floats, ints and strings and create the proper data type accordingly for each item. It won’t check for list’s within the list. yet…

The “cell list” can either be just a series of items separated by commas or it can be a properly formatted list with square brackets and quotes for strings. ie:

somestring, 23, 4.5, another string, "etc..."

or

['somestring', 23, 4.5, 'another string', 'etc...']

It wil take the td.Cell object or the cell value.

There are a couple of example scripts that grab a “cell list” and store it in a COMP and copy it into another table.

Hopefully it comes in useful
cheers
Keith
listFromCell.toe (4.18 KB)

1 Like

Hello Keith,

Quite an old post, but very useful for me, thanks!

Since so many years have passed from this, is there any other advance on cells taking lists? Perhaps another operator I’m not aware of?

Best,
Q

Hi Qvoloid,

You might consider looking at dictionaries and storage as data management strategies if you’re looking for more complex ways to store and retrieve information.

There’s an example up here that might be useful for you:

https://github.com/raganmd/ModuleAndStorageExamples

Cheers,
M

Hi,

I just had to deal with a special use case where you have a list in a cell. it is with the lister and color value ( colored Cell) that must be in a list format [r,g,b,4,name].
So if you need those values outside the lister, you have a list in a string.
I haven’t found a better solution than the function provided by keithlostracco.
I tried with no luck the python repr().

you mean a = eval(‘[1,2,3]’) ; print(a[2]) ?

yes, exactly :slight_smile:
magic !
thanks greg .