(From d1 In dt_leavesheet.AsEnumerable()
From d3 In dt_timesheet.AsEnumerable()
Where d1(“Employee”).ToString().Trim().Equals(d3(“Employee”).ToString().Trim()) AndAlso
d1(“Start Date”).ToString().Trim().Equals(d3(“Start Date”).ToString().Trim()) AndAlso
d1(“End Date”).ToString().Trim().Equals(d3(“End Date”).ToString().Trim())
Select d1).Copytodatatable()
Using Above query for comparing the datatables and filter result well be written in an excel file by using ‘Write Range’ activity.
1) Enabling the ‘Use Header Row’ option prevents errors.
2) Disabling the ‘Use Header Row’ option results in errors.
Note:- And I want to write the result without header. Because i’m using ‘Write Range’ activity in a loop and in each iteration it’s writing the header again n agian that is not the desired output.
All UseHeaderRow
does, is run 4 lines of code do add the headers, so I am having a hard time understanding that should be the error. Please test that again.
The error looks like a .net error and not one from excel, i suspect that error is not from write range, but either you cast or your call to Copytodatatable.
Could you set a breakpoint and single step though the activities and validate what step is giving you the error. If you are doing multiple things in one activity, then split it up to multiple assigns so you can test what step is throwing the error.
If you google the error you will see alot of hits on uipath’s forum and they all releated to linq queries. Seems linq does not know how to cast the types from datatable, so you need to add .field(of ) to cast for linq. Try having a look at some of the post.
(From d1 In dt_leavesheet.AsEnumerable()
From d3 In dt_timesheet.AsEnumerable()
Where d1(“Employee”).ToString().Trim().Equals(d3(“Employee”).ToString().Trim()) AndAlso
d1(“Start Date”).ToString().Trim().Equals(d3(“Start Date”).ToString().Trim()) AndAlso
d1(“End Date”).ToString().Trim().Equals(d3(“End Date”).ToString().Trim())
Select d1).Copytodatatable()
Using above query for comparing.
** Disabled the ‘Use Header Row’ option in write range activity. so for first iteration it’s printing the result without header but for next it throws an error:Error Message : Unable to cast object of type ‘System.Double’ to type ‘System.String’.**
Attaching a resultant picture of write range activity for better understanding.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.