• Documentation
  • Workato Blog
  • Product Blog
  • Return to Workato
  • Login
  • Automation Institute
  • Documentation
  • Community Forums
New Topic
Discussions Recipe Building Recipe Building Questions
S

Saul Macht

started a topic about 3 years ago

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?

Amanda Wong

said about 3 years ago

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.


S

Saul Macht

said about 3 years ago

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?

Amanda Wong

said about 3 years ago

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

Login to post a comment

Still can't find your solution?

Send us a ticket, we will try our best to assist you with your problem

Documentation
Developer's Library
Tutorials
eBooks
Product Hour
Product Blog
Workato Blog
Product updates
Customer Stories
© Workato 2022   Privacy   Terms   +1 (844) 469-6752
  • Documentation
  • Workato Blog
  • Product Blog
  • Solutions
  • Forums
  • Tickets
  • Log in
  • Return to Workato
Topic views count