Only last item of the list is written to CSV

Hi guys, I am trying to create a list with running numbers and its contents (in this case sorted according to number in ascending order) in CSV format like below.
1 a 80
2 b 81
3 c 82…etc

Here is my attempt and everything seems fine until the write to CSV file. It appears null and only gives me the last item of the list. I do not know what went wrong.

Can anyone shed some light on this please? Thank you.

The list you are sending to the CSV is a step too deep at the moment, so you are actually writing the [item, pair of items] csv for every triplet of data.

Before your List.Join node you can use a List.AddItemToFront to our each item from the range into it’s own list, resulting in a list of lists with one item in each sublist.

The use a List.Flatten node with the list level set to @L2 to remove the extra level of depth.

Hi Jacob,

Thank you for your kind reply. I have tried according to your suggestion and attached below. However I didn’t get the outcome that I’m expecting. The good thing is my data is all written to CSV but the formatting is not what I expected. I must have done something wrong, can you please help me again? Thank you.

Try this?

TEST.dyn (27.5 KB)


Thank you Jowenn, it works!

Ah! Missed a @L1, but it wouldn’t have had the formatting you were after. Glad you’re squared away. :slight_smile:

Thanks for your time and effort tho :wink:

1 Like