I have 3 columns and I need to report 1 based on my input

Hello,
I am struggling with my homework. When I click "get column [#] from[data]" its suppose to report a single column based on what number i put in. Every time I click the "get column" it shows me the entire data table that I imported. The data is something i imported. If I put in 1 its suppose to show me the whole A column. If i put in 2 (get column [2] from [data]) its suppose to show me only column b. Hope that makes sense

Welcome to SNAP!

You are seeing the entire array because you're adding every row in your table to your listOfReturn list. Also, your function has a columnNum# parameter which not used at all in the code.

If you use the following code, then you will be able to split a ROW of your table into its columns as a separate list:
image
Once in that format, you can reach the desired column with your columnNum# value in place of the item numbers 1, 2 ,3 with this block structure:
image

col1: image

col2: image

col3: image

I changed it up as I understood more clearly what you were saying. For your "my list" what was inputed? I tried putting "data" which refers to the table. I get the response "expecting text instead of a list
Screen Shot 2020-05-07 at 8.00.12 PM

Since you want to process the entire DATA array, you need to iterate over that list using your rowNumber variable in the "item 1 of data" block, eg: item rowNumber of data.
Also in your original post, listToReturn was initialized to list, but not so in the latest version.

Thank you for your help!!! I appreciate it.

Hi! Are you enjoying BJC?

You guys are making this way too complicated. First, there's no need for SPLIT; you already have your data arranged in a table, just as it should be.

Second, don't write code that loops on an array index. (Did you learn that in Python or something?) In Snap! you can deal with the entire list at once!

If you had just one row of the table, let's say in a variable ROW, and you wanted to extract the third column, you'd say untitled script pic, right? (Actually, if you're doing the lab I think you are, you should already have written a block called FIELD for data abstraction, and you'd use that instead of ITEM: untitled script pic (1).)

So, if you want to get field 3 of every row, you'd just say
untitled script pic (2)

Right?

I have a more general comment. If you read the paragraph you wrote at the very beginning of this thread, you talk about COLUMN as if someone else had written it, and you had to figure out how to use it. But you're writing it! If you've written it correctly it'll work correctly. In the code you wrote, you said
untitled script pic (3)
It can be dangerous to rely on the names of variables, but in this case you did a good job of naming them, so "rowNumber" is indeed a row number. And "array" is indeed the entire array. So, what are you asking ITEM to return? And, therefore, what are you asking ADD to add to the result list?

One more little thing. In Snap! you can have multi-word variable names, so there's no need for hideous camelCase: untitled script pic (4)