Extract specific values from CSV cells and write into Notepad

Hello, Community!

I need to take a value from two CSV columns, loop through each row one at a time, and write the results in Notepad. I have already used Read CSV to convert CSV into Dt. From here I have a For Each Row activity but am a little confused as to where to go from here.

I need to extract InvoiceNumber and InvoiceAmount, write them to Notepad, then loop through each row doing the same thing until there no more rows to process.

Thank you in advance!

1 Like

To clear up any confusion:

  • I need to loop through a datatable
  • Extract the CheckAmount, InvoiceNumber, InvoiceAmount
  • Assign to variables
  • Start separate process using those variables
  • Come back to the second row and repeat until no rows with data remain.


1 Like

hope these steps would help you resolve this
–hope we have the datatable ready named dt
–now use a FOR EACH ROW activity and pass the above variable dt as input
–inside the loop use a assign activity like this
str_checkamount = row(“CheckAmount”).ToString
and another assign activity
str_InvoiceNumber= row(“InvoiceNumber”).ToString
and final assign activity like this
str_InvoiceAmount= row(“InvoiceAmount”).ToString

where all these variables are variable of type string

–now use a write text file activity where pass the file path as we want and in the input mention these three like this
str_InvoiceNumber+" “+“str_checkamount”+” "+str_InvoiceAmount

and if we want to create separate notepad file for each row one by one
then along the file path mention like this

Cheers @Zroy21

Thank you for your response, Palaniyappan.

I actually have that exact part done. However, instead of writing to a text file, I need to store the row variables, then begin another subprocess to enter the line variables into another application.

Essentially, I am:
Staring the loop on the first dt row,
extracting the 3 variables,
processing them in another workflow instead of entering them into Notepad (ie: entering each into another application),
coming back to the dt and taking the same 3 variables from the second row and doing the same thing until there are no more rows with data in the dt

Would you be able to provide any additional info on how to perform this? Thanks again!

I hope that clears up my situation a little better.

I would assume that I would need to utilize some sort of counter for the number of rows with data in the dt until the it returned a null value?

subprocess means another workflow file (like a xaml file) or a sequence of activities

no not necessary buddy
within the for each row loop itself we can use a IF condition like this
if true if will go to THEN part where we can have all those assign and further activities or it will go to ELSE part where we can leave it empty so that it will iterate to the next row or we can use BREAK activity to get out of iteration and the process will stop after that row


1 Like

Thank you very much for your quick responses. You have been extremely helpful!

1 Like

Cheers @Zroy21

See this for help: Main.xaml (10.8 KB)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.