Hi Saul,
You can check this recipe: https://www.workato.com/recipes/1126554-convert-list-data-into-csv-with-list-sequence-number#recipe
First, define a Row Number column for the CSV. When you are mapping source list fields with an array/list data like in the screenshot below, you can use the `List Index` data pill which returns the index of the array items to determine the row number. Since Index begins counting from 0, you can add 1 to the index to get the sequence number.
Thank you. What if I want to group the data by a field, and add a sequence number to the data rows, beginning at 1 for each group?
Hi Saul, you can achieve that by looping through each group, extracting the data for each group, and make use of the List Index data for mapping sequence number in the previous example I shared. You can compile the transformed data in a temporary list, and extract the compiled data in your desired format at the end.
You can refer to this recipe: https://www.workato.com/recipes/1143796#recipe
Send us a ticket, we will try our best to assist you with your problem
Saul Macht
How do I add a row number column to my csv?
I am querying data from an application and would like to convert the results into a csv. I would also like to have an additional column for the row/sequence number of each data row.
How can I achieve this?