tag:support.nodebox.net,2012-11-01:/discussions/nodebox-2-3/6346-list-pick-from-index-in-order-rowNodeBox: Discussion 2021-03-23T22:37:06Ztag:support.nodebox.net,2012-11-01:Comment/490919882021-03-17T01:31:44Z2021-03-17T01:32:50ZList - Pick from index in order row<div><p>Hi Asgardesign,</p>
<p>There are several ways to do this.</p>
<p>If you have a simple list of values and you want to take, say, the 4th item in the list, you can use a slice node. Feed the list into the list port, set start index to the item you want, and set size to 1; that will return the item. When setting the start index remember that counting in NodeBox starts with 0, so to pick the 4th item you should set start index to 3.</p>
<p>If you have a CSV with multiple columns and you want to pick a particular row based on the value of an index column, use a filter_data node. Feed the table into the data port, set Key to the column you are using to store your indices, set Op to =, and set Value to the value of your index. This will return all rows with an index equal to Value; if your index column has only distinct values (no repeats) this will return a single row.</p>
<p>Since Filter_data returns entire rows, you will then need to feed the filter_data node into a lookup node to retrieve just your hex value.</p>
<p>Notice I said that you need to set Key to "the column you are using to store your indices". When you look at a CSV table from NodeBox in Data mode it will show the first column with number indices (0, 1, 2, etc.) labeled "index". But that index column is not an actual column in your CSV and cannot be used as a key when filtering. To filter by index you will need an actual column in your CSV table with ID values you can use to identify each row. You can even call that column "Index" if you want and place numbers (0, 1, 2. etc.) in that column. Or you could call it "color name" and put unique color names in that column that can serve as identifiers to pick a particular hex value.</p>
<p>If your CSV only has a single column (e.g. "hex") and you don't want to add your own index column, you can just use a lookup node (Set key to "hex" or whatever the column is labeled) on the CSV node. This will return a simple list of hex codes. You can then use the slice node on that list as described above.</p>
<p>Please let me know if that all makes sense and solves your problem. If not, feel free to reply and attach your CSV; I will make a quick network for you that will return individual hex codes.</p>
<p>Have fun!</p>
<p>John</p></div>johntag:support.nodebox.net,2012-11-01:Comment/490919882021-03-17T08:35:23Z2021-03-17T08:35:23ZList - Pick from index in order row<div><p>That's perfect, many thanks :)</p></div>Asgardesign