Hello,
I have 2 Excel file. which consists of data.
File1 has been attached.
Basically I need to Fetch "Credit " for “Acquirer WDL Transaction Amount” and “Acquirer WDL Transaction Amount (Micro-ATM)” , from ‘FILE1’
And write those amount in other Excel file! (FILE 2)
FILE1.xlsx (10.2 KB)
Regards,
Nidhi
Palaniyappan
(Palaniyappan P )
September 20, 2021, 11:49am
2
Hi
Hope these steps would help you resolve this issue
Use a excel application scope and pass the file path as input and get the output dt with READ RANGE activity
Now use assign activity and mention like this
dt = dt.DefaultView.ToTable(False,”Description”,”Credit”)
Now dt will have only the first and second column
Then use the below assign to get the datatable with those two rows in exact
dt = dt.Asenumerable().Where(Function(a) a.Field(of String)(“Description”).ToString.Contains(“Acquirer WDL Transaction Amount”) AND a.Field(of String)(“Credit”).ToString.Contains(“Acquirer WDL Transaction Amount (Micro-ATM)”)).CopyToDataTable()
Now use a write range activity and pass dt as input
Cheers @nidhi.kowalli
Yoichi
(Yoichi)
September 20, 2021, 12:51pm
3
Hi,
Hope the following helps you.
dt = dt.AsEnumerable.Where(Function(r) r("Description").ToString="Acquirer WDL Transaction Amount" OrElse r("Description").ToString="Acquirer WDL Transaction Amount (Micro-ATM)").CopyToDataTable
Sample20210920-1.zip (12.1 KB)
Note: You might need to modify range of ReadRange activity if you want to process only first table in the sheet.
Regards,
1 Like
@Palaniyappan
Got RUN TIME ERROR!
" Assign: Unable to cast object of type ‘System.Double’ to type ‘System.String’ "
Thank you!
works.
If you could see, there are 2 entries for “Acquirer WDL Transaction Amount”.
Out of which I need to fetch only the first part!
This is where I’m facing issue.
Yoichi
(Yoichi)
September 20, 2021, 1:34pm
6
Hi,
I need to fetch only the first part!
I just modified it as the following.
dt.AsEnumerable.Take(num).Where(Function(r) r("Description").ToString="Acquirer WDL Transaction Amount" OrElse r("Description").ToString="Acquirer WDL Transaction Amount (Micro-ATM)").CopyToDataTable
Sample20210920-1v2.zip (10.6 KB)
Hope this helps you.
Regards,
Hi @Yoichi
Thank you for the solution.
That is working.
But Can you please explain me why have you used VLOOKUP and Filter here?
Regards,
Nidhi K
Yoichi
(Yoichi)
September 21, 2021, 6:03am
8
Hi,
In the Sheet, each part starts with cell which has “Description”. So we can get index number of the cell using LookupDataTable (Lookup for “Description”) (Let’s say num
as the index number)
Then, we can get first num rows using Take(num) method in the middle of the expression.
As a result, we can get the first part and get target rows in it.
Regards,
1 Like
Hello,
Thank you for knowledge.
Sharing you an actual file.
Issue m facing is, The above code works well with “Acquirer” part.
I also need to Fetch “Issuer” part . which is giving me error!
I have highlighted Cells, which i need.
please get me a solution!! NTSLJSF030821_1C.xls (9.7 KB)
Yoichi
(Yoichi)
September 22, 2021, 1:04pm
10
Hi,
Your xls file seems illegal format. Can you check it?
Regards,
Yoichi
(Yoichi)
September 22, 2021, 1:16pm
12
Hi,
Can you try the following expression? I haven’t test it, but it will work probably as expect.
dt = dt.AsEnumerable.Take(num).Where(Function(r) r("Description").ToString.Contains("WDL Transaction Amount")).CopyToDataTable
Regards,
ERROR!
Assign: Column ‘Description’ does not belong to table DataTable.
Yoichi
(Yoichi)
September 22, 2021, 1:33pm
14
Hi,
In my environment, it works without error.
Can you check the following?
Sample20210920-1v3.zip (20.5 KB)
Regards,
1 Like
Thanks a lot!
Its working fine.
Probably I must have done some mistake. Will check with that.
system
(system)
Closed
September 26, 2021, 5:57am
16
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.