Hi
I want to get the row count of an excel column “Column2” using linq query.I want to check if the row count is greater than 5. Is there any linq query for that. Also if there are no rows it throws an error but it should just move to the next activity
You dont need linq for it you can directly read the data into datatable(dt) and use dt.rowcount > 5
Are you looking for something on filtering and all?
cheers
No while using dt.rowscount if there are no rows then its throwing an error.
then initialize the datatable using ‘New Datatable()’ then it will not throw error
cheers
If there are values in dt then i also had to copy that values to new dt.
This is not copying the data. Thsi is to initialize the variable that you have for datatable
Say your datatable is dt then use assign or in ‘variable panel’ in default value give New Datatable() .This will initialize your dt so that it would not throw error and any new data if present will be added to dt itself
cheers
This is how you place it
Then when no rows are there it will give zero instead of throwing error
Hope this clears your issue
cheers
Hello @Amruta_George1
You can do as below. First assign activity is the declaration of the Datatable variable. So even if the datatable is null, it will not throw any error.
To get row count:
DT1.Rows.Count
Thanks
Hi @Amruta_George1 ,
What about this condition
Workflow
Input
Output
Condition
dt.AsEnumerable.Where(Function(x) x(“Column2”).ToString<>Nothing).Copytodatatable.RowCount>0
Thanks,