Hello @Vaibhav_Rajpoot_17
Assign activity is throwing above error. I guess the Data table column i.e ([Contract Start Date] & [Close Date]) from my excel sheet is not a date type.
I am attaching the excel sheet for your reference.
it seems that some of the cell have null value due to which exception is thrown.
Refer this Query its working fine →
dt_Refer.AsEnumerable.Where(Function(x) cdate(x("Close Date (Expected Signing or Date Won/Lost/WD)")).ToShortDateString<CDate(x("Contract Start Date")).ToShortDateString).CopyToDataTable
@Vaibhav_Rajpoot_17
Your query is working fine since you interchanged the column names which also changes the resultant records.
I want below query to get is worked. But its giving incorrect records even after removing all the null values from both the column.
dt_Refer.AsEnumerable.Where(Function(x) cdate(x(“Close Date (Expected Signing or Date Won/Lost/WD)”)).ToShortDateString>CDate(x(“Contract Start Date”)).ToShortDateString).CopyToDataTable (Changed the operator to >) Number of records are approx 2000
Below are the result I am getting also which is incorrect.
This copies the rows from your DataTable ( if any ) that meet the condition to a new DataTable ( resultsDT ), otherwise just makes a New DataTable.
If (
( From results As DataRow In yourDT.AsEnumerable()
Where DateTime.Parse(results.Item(“Close Date (Expected Signing or Date Won/Lost/WD)”).ToString) > DateTime.Parse(results.Item(“Contract Start Date”).ToString)
Select results
).Count > 0 ,
( From results As DataRow In yourDT.AsEnumerable()
Where DateTime.Parse(results.Item(“Close Date (Expected Signing or Date Won/Lost/WD)”).ToString) > DateTime.Parse(results.Item(“Contract Start Date”).ToString)
Select results
).CopyToDataTable(),
New DataTable()
)