Convert column value from datetime to string

Hi, my column value is date. I am filtering the rows by date. but not working

input1.select(“convert([Provision Date], ‘System.String’) like ‘April’”).length > 0

image
image

Pls help.

Thank you xoxo

1 Like

If you want to filter only April, you can use this.

input1.select(“[Provision Date] like ‘%Apr%’”).length > 0

Nope, not working

1 Like

Then Convert and filter as you did before :slightly_smiling_face: Only change is % and Apr

input1.select(“convert([Provision Date], ‘System.String’) like ‘%Apr%’”).length > 0

Hi vivek, it doesn’t give me errors but it is not working. It is going to the else condition when it is suppose to go to then condition. Refer to above for the excel file

1 Like

Then give “Not” operator on your if condition.

not input1.select(“convert([Provision Date], ‘System.String’) like ‘ April ’”).length > 0

haha I can’t do that since I have to use that to filter rows in assign

Use a writeline and check the output of input1.select(“convert([Provision Date], ‘System.String’) like ‘ April ’”).length. To ensure the code is correct

Hey vivek, how can I do that?

@sangasangasanga please go through this thread, it may help

Thanks,
Pooja

You need to add .tostring

input1.select(“convert([Provision Date], ‘System.String’) like ‘%Apr%’”).length.tostring

hI, I tried, pls help
Main.xaml (14.6 KB)
Month Sep 2018_v1.0.xlsx (30.9 KB)

Hi, thanks for your recommendation but the date format is different, I dont think will work.
Even though it appears like this
image
I think the format is this
image
I don’t know which format RPA is looking at

@sangasangasanga first you need to convert the date format from 2-Apr-18 to 2/4/18.

image

2 Likes

@sangasangasanga Check the below workflow, it is working fine, i have just created workflow for filtering date.

Main (1).xaml (12.5 KB)

check the output got in sheet2.

MND_FFE Monthly Report for Service Month Sep 2018_v1.0.xlsx (31.4 KB)

Hi @sangasangasanga,

  1. Use a for each row activity and print the values and observe how it looks like. You can write like : row(0).tostring.
  2. Then write your select query accordingly without the for each row…
    May be you can try something like
    Input.select([Provision Date] Like ‘%Apr%’).CopyToDataTable
    You have to assign it to a datatable so that it can hold the filtered results in a datatable.
    Thanks,
    Jiban