How Do You Read a Multi-Column List in Snap!

I imported a multi-column .csv file into Snap! and need to know how to read items from specific columns. Preferably a custom block similar to the one shown below. (I didn’t make it yet; it is a dummy custom block.)

untitled script pic-3

So you did something like this?

That output is actually just a list of lists (with each child list being a list). You can get this meta-list by right-clicking on the resulting table and clicking list view..., or by disabling table support via Shift - :settings_icon: - Editor… - Table support (I had to do this to get a result picture of it):

Thus, to implement your block:
untitled script pic(30)
:~)

(Note that I used a number for the column, not the letters. If you want me to change it, tell me – or maybe you could do it yourself as a exercise.)

This is my .csv (Only a Example)

I just dragged the file into the Snap! window

Raw:

Name:,Job:,Age:
John,Dentist,42
Andrew,Welder,25
Smith,Cashier,34

Image:

try item (john v) of (csv) (you can type in the input)
you might want to watch this: https://www.youtube.com/watch?v=2HcLdoT5_6U&t=8s

So to find the (item of row of column in list) you would do this script below?

untitled script pic-4

Also, how would it be done the other way around?

Because doing the index of “John” in list reports zero, even when “John” is in the table.

untitled script pic-5

Or just do item (Andrew v) of (csv)

My Program Doesn’t Know What is in the column 1 row 2. I’m Using the list as a database.

So ( index of “Andrew” in (List) ) reports 0 even though the is a 'Andrew" in the Table.

Ohhhhh. I’m Sorry, I Didn’t Understand what you were saying. First of all you are right, doing (item “Andrew” of (csv)) will give me Andrew’s job and age. I wanted his job and age separately and that’s why I filtered it again with another (item of (list)) block.

I though you were saying doing < Index of “Andrew” in (list) > acted like a (item# of (thing))

But the (item “Andrew” of (csv)) kind of works like a (item# of thing)

I thought using the (item “Andrew” of (csv)) would give me where it was on the table

Could you give us a link to the project you are trying to make? By the way, you can put images of snap blocks in the forum using [sb] … [/sb].

What kind of wizardry are you using to make not it transform into snapblocks?

\[sb] ... \[/sb]

He didn’t use preformatted text, well it doesn’t show up like that on my end.

i know, just remove the `s

[sb] … [/sb]

Huh, I never knew that!
I just didn’t realize the \ 's at first

I have Updated the Description at the top

There is no reason why the block should give you an index, your has 4 items in it, and none are John. I’m still wondering why you need to find the index of john, because I believe we could easily help you get around needing that if we know the context of what you’re trying to achieve.

What are the If <> True ::control and If <> False ::control blocks supposed to do?

I Made those a while ago and use them all the time

The [If < > True] Block, if the boolean is true it will continue with the script. If the boolean is false it will stop.

The [If < > False] Block, if the boolean is true it will stop. If the boolean is false it will continue with the script

All I really wanted was to have a block that could tell the program what was in specific cells.

Also the other way around. I wanted a block that could report the row and column of the spot with a entered keyword

Real World Example:

Say I had a .csv file of every employee and had a program that I used to search a large list of employees. If I Needed the job of Patrick. I can search the .csv for Patrick, find the row and column, then add 1 to the column so I can get the age.

I Don’t Have Much experience with first class lists. Sure they are more advanced, but I find them unintuitive.