Skip to Content
0

Convert String to Date and use as a Search

Feb 27 at 12:33 PM

16

avatar image
Former Member

I'm having a bit of a mare. I'm using CR 2016 and the data field is reporting the Date as a string (01/01/2018). I have tried a number of solutions i.e. CDate etc. Although it appears to work and the fact I have a {?DateSearch} Parameter (works on my Date formats 100%). The {?DateSearch} Doesn't work when i convert the String to Date.

I Can't add anything into Select Expert - Record as it keeps saying String expected.

Am I missing somthing?

Any ideas?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Abhilash Kumar
Feb 27 at 02:19 PM
0

Hi Paddy,

What is the datatype of the {?DateSearch} parameter?

Also, what database are you reporting against? Are dates being stored as a string in the database as well?

-Abhilash

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Abhilash,

The Parameter {?DateSearch} datatype is set as a date and is also set to true for Allow range values. The Database is OLE DB and sadly all of the dates that I want to use are Strings (dd/MM/yyyy). I require Date (dd/MM/yyyy).

Paddy

0
Ian Waterman Feb 27 at 02:14 PM
0

Its not very fast but this does work as I have used it, assumes datestring as DD/MM/YYYY, adjust accordingly if MM/DD/YYYY.

In this case parameter {?DateSearch} is a date.

Date(tonumber(right(Yourdatestring,4)), tonumber(mid(Yourdatestring,4,2)),tonumber(left(Yourdatestring,2))) = {?DateSearch}

Ian

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Ian,

The {?DateSearch} works fine in other reports but because the table field is a string stops it coming back with those dates I have entered in it. the Date format of dd/MM/yyyy is fine.

Paddy

0

Then my suggested formula should work

Ian

0