Filter data table columns but value stored as string

Trying to filter columns using the Filter Wizard however the columns are strings.

The first condition are if column A has an value less than an integer value, that the user would input. However I am unable to use the < operation given that the data in the data table is a string. Also under this column not all the values are integers.

Second condition is if the date comes before a certain date, input by the user. The date is also a string in the form yyyyMMdd.

For integers, if Col1 is your column, use CInt("Col1") to convert it in the wizard.

For dates, if Col2 contains the date, use DateTime.ParseExact(Col2, "yyyyMMdd", System.Globalization.CultureInfo.Invariant).

1 Like

Currently getting an error “Column type is not supported.”

(Cint(6)).IsNumeric
I’m using the IsNumeric given not all data in the column is an integer

DateTime.ParseExact(“DATEENTRY”, “yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture)
Made a small change with your code given I was getting an error “Invariant is not a member of System.Globalization.CultureInfo”

wizzard1 wizzard2

You’ll need to remove the IsNumeric part from CInt(6). IsNumeric returns true if a string can be parsed as a number, but if your column only contains integers, using CInt(6) should be enough.

well I did mention that not all the values are integers in this column.

In that case, try creating a new column which has the data as integers if possible to convert, but some other default integer otherwise. That way you can use Filter Datatable more easily.