I have input (notepad)
Did read CSV and created a variable dt1 as datatable.
Build datatable and named two columns as House and account (dt2 datatable)
Did for each row in data table and and called dt1 as datatable and for each as CurrentRow
Did assign change(arrey of strings)={account details} , note accountdetails is the output of an application (which is a service no)
Did For Each loop (in which ForEach is item and In Change (array of string)
In the Body added write line and declared item.tostring
8.added assign account ( as mentioned in build data table)
9.added data row and in ArrayRow added {CurrentRow(0).toString, account}
Write CSV from dt2
In the output panel I see 2 service no but in output CSV I see 0 showing under account
Can anyone help me in getting the service no in notepad
vrdabberu
(Varunraj Dabberu)
January 7, 2024, 3:24pm
2
Hi @dipon1112000
In the Add Data Row have you given the below way:
{CurrentRow(0).ToString, account}
In datatable you need to give dt2. Since Build Data Table output is dt2 and you are adding the rows to that datatable.
=>Pass that dt2 to Write CSV activity.
Regards
Yes I did
I am getting the account no in output also but output CSV has got 0 under account
I see in the output panel 0, then account no, then 1, and then another account no
I thought that both the account no will show up in output CSV but only the 0 is coming twice
lrtetala
(Lakshman Reddy)
January 7, 2024, 3:57pm
4
Hi @dipon1112000
Could you please share the xaml file and notepad file then it will be helpful for us to sort the issue.
Cheers!!
vrdabberu
(Varunraj Dabberu)
January 7, 2024, 3:59pm
5
Could you share the input text file or the screenshot of that. Will help you with the code @dipon1112000
Regards
This the build datatable
This is the output from application
Here I am assigning output of application to arrey of string
Then in ForEach
Then did add data row
And passed it to cav
Output panel shows
vrdabberu
(Varunraj Dabberu)
January 7, 2024, 4:39pm
7
Hi @dipon1112000
Follow the below process:
=> Use Read CSV acitivty to read the notepad and store it in an datatable.
Input:
Output=dt1
=> Use Build Data Table activity and give below way:
Build Data Table
Output:dt2
=> Use For Each row in datatable to iterate through dt1
=> Inside that use this in If condition
If
account_details.Length>0
Then
Assign-> account= account_details(0)
Assign-> account_details= account_details.Skip(1).ToArray()
End If
=> Use Add Data Row and pass the below syntax in ArrayRow
ArrayRow -> {CurrentRow(0).ToString, account}
DataTable -> dt2
=> Use Write CSV to write it back to otuput file
Output:
Workflow:
zip file:
FORUM CSV TASK 2.zip (50.0 KB)
In your process you have used For Each to loop through the array of strings right remove that and place if condition and pass the below syntaxes
If
account_details.Length>0
Then
Assign-> account= account_details(0)
Assign-> account_details= account_details.Skip(1).ToArray()
End If
This should solve your problem
Happy to help if difficulties faced.
Regards
What variable have u declared HouseNo and Account
vrdabberu
(Varunraj Dabberu)
January 7, 2024, 5:12pm
9
@dipon1112000
House no and account are of Datatype System.String
Regards
Thank you very much god bless you sir
1 Like
It’s working but I am getting details twice
I fixed it thanks for your help
system
(system)
Closed
January 10, 2024, 6:25pm
13
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.