Filter data table to integer

Hi, I’m trying to filter a data table with date and assign the result to an integer. I want to filter with a check date which can be 2019-10-10 as an example.

Data table output (dt_CheckDates):
Column 0, Column 1, Column 2, Column 3, Column 4, Column 5, Column 6, Column 7, Column 8, Column 9 Column-10 Column-11, COLUMN 12, the Column 13 Column 14

13614519, lerjob4912,2018-06-01, Business For Utilities, Listing, 1872991343,1030421874,300,1033921300, lerjob4912, Business For Utilities, 2018-06-01, ChangerName, Lena Johansson

I have tried the following:

Assign: int_runErrand = CInt (dt_CheckDates.Select (“[Column-2] <= '” + datetime_set.ToString + “'”). Count.ToString)

Will not go further so I gratefully receive help.

Best regards

Daniel

Correct column name in output.

@Daniel_G

Try this:

    int_runErrand = dt_CheckDates.Select ("[Column-2] <= ‘" + datetime_set.ToString + "’").Count

Hello @Daniel_G

Welcome to the community…

Another approach would be to use the filter datatable activity. This will filter the datatable so that it will only have the records of the particular date your provide.

Next use an assign activity to get the row count
FilteredDT.rows.Count

Thanks for the reply. Tested this and got the error: Assign: Syntax error: Missing operand after ‘00’ operator.

Not sure what the error means.

1 Like

Thanks!

I’ll try to use the filter datatable activity. Do you have any tips on how to do it?

I used filter datatable activity to filter but before that I had to change the data type to the date of the column to System.DateTime. I did this with the Nuget package ChangeColumnDatatype.Activites

Thanks for the help

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.