Hello, I read a CSV file to datatable. It has 3 collums (First,Last,Club member) and i need to put all rows with not Club members to another CSV file and all club members to write in the ‘Output’. I used for each row cycle and I put if into it, where statement is: row(“Club Member”).ToString = “Yes”. After then i normally write First and Last to output, but the problem is, how can i put the other datarows to new datetable, which i will write to CSV. Or can i delete rows with members in this datatable? It wrote me an error…
Thank you very much for your advices.
Hi @myName,
From your description i understood that you want to write all the ‘club members’ to one csv and the ‘first’ and ‘last’ to another.
create 2 datatables, dt1 and dt2
For this, you can iterate through the datatable which you got after reading the csv.
then use the if condition as you mentioned in the description.
it if’s True case , Use ‘Add Datarow’ activity and add the data to dt1
similarly in if’s false case, use another ‘Add Datarow’ activity and add the data to dt2
then after exiting the for each, write both data tables dt1 and dt2 to different csv files.
Hope this helps.
Thank you. I have tried this, but, when i use Add Datarow, it show me an error, that this datarow is alredy in another datatable.
I think you are simply passing the datarow variable inside the for each row activity. Instead of that, in “add datarow” activity - pass values as array row(in properties panel)
Yes, you are right. Now it works. Thank you very much for your help.