Need help with building a list of lists in Code


The attached block is a simple example for the List of Lists that I am trying to build in code by reading the values from a file and then building the List...

Maybe the file contents would be more helpful?

Here you go (sub sample)

0007.620 Write :EQ3852# 3868 3900 Solar System#
0007.671 Write :EQ3900# 3916 0 Mercury#
0007.711 Write :EQ3916# 3948 0 Venus#
0007.751 Write :EQ3948# 3964 0 Mars#
0007.789 Write :EQ3964# 3980 0 Jupiter#
0007.832 Write :EQ3980# 3996 0 Saturn#
0007.872 Write :EQ3996# 4012 0 Uranus#
0007.913 Write :EQ4012# 4028 0 Neptune#
0007.956 Write :EQ4028# 4044 0 Pluto#
0007.994 Write :EQ4044# 4060 4076 Moon#
0008.035 Write :EQ4076# 4092 0 Overview#
0008.073 Write :EQ4092# 4124 0 Landing Sites#
0008.129 Write :EQ4124# 4140 0 Craters#
0008.170 Write :EQ4140# 4156 0 Mountains#
0008.214 Write :EQ4156# 4108 0 Mare,Lakes...#
0008.263 Write :EQ4108# 4076 0 Valleys,Rills..#

I can read the file, clean it up and break it into its subcomponents. I am struggling in building the list of lists.

I see this as a 5 column table, after removing the boiler plate.

Last row might be
0008.263, 4108, 4076, 0, "Valleys,Rills..."

Am I close, or would you like the features added as extra columns?

After I read/clean the file I end up with 4 element per row:
[":EQ3852", "3868", "3900", "Solar System", ":EQ3900", "3916", "0", "Mercury",etc...

The end game is to create a Listpicker showing the values at each Level...

That looks like at least 8 elements per row.

Are you really happy with that?

If you are cleaning in AI2. show your blocks.

For something like this, I would start with a Split at '#\n' to get one item per row, then pass the resulting list through one of the advanced list blocks that can hold code to transform row text into sub lists.

How would you label each part of a row, if you were to make headings on a table or show them in YAML?

I transform the file into one big list (each 4 elements is a row of data). Based on the values of the 2 & 3 elements of each row, I can decide if its an new list or elements of the previous list...

can you give a simple example of the code to create a list of lists based on the block i have attached.

Good you told me that.

So it's a parts explosion table structure.

I used one of those in my sample app

I'll go eat supper while you think of names for those columns.

Names are important.

Thanks and enjoy your supper.

Here's the output table, in Comma Separated Values (CSV) format.

image


ToTheMoon.aia (4.1 KB)

I cleaned off what looked to be boiler plate, and you did not want column 1, so I left it off.

Thanks a lot, you dinner must have been really good....

Cheers.