cancel
Showing results for 
Search instead for 
Did you mean: 

A string is required here

Former Member
0 Kudos

Hi guru,

When I am running a report the error is poping up " A string is required ". After clicking the OK, it is taking me to Forumla editor

{CLARITY_TDL_VIEW.POST_DATE} in {?Select Start Denial Post Date} to {?Select End Denial Post Date}

After doing some research, I tried using ToText and Cstr functions, But no luck. Please help me out

Regards

R

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Reddy,

There are a couple of things to check...

#1) Look at {CLARITY_TDL_VIEW.POST_DATE} in the Field Explorer. Make sure the Show Field type is turned on (right click the the Database Fields and make sure there is a check mark next to it)... and make sure it says :DateTime next to the field name.

If in fact it does say DateTime, you shouldn't be having any problems using date or date time parameters in your formula.

If not, keep reading.

#2) Check the ODBC or OLE DB driver you are using. SQL Server introduced new drivers for 2008. You should be using the SQL Native Client 10.

#3) SQL Server 2008 also introduced 2 new date formats Date & SmallDateTime... In your last post you said you checked "the back end", which I assume means you looked in the SQL Server Management Studio. If you do in fact have access to the SSMS you can find your field in the Object Explorer to see which of the date types your field is.

You mentioned that it was formatted as 2006-12-31 00:00:00.000 which is the old standard DateTime, but it doesn't hurt to check any way.

Jason

Former Member
0 Kudos

Hi Long,

I checked the option # 1 as you mentioned where the Field type is showing just Date . Please let me know where I can change the Field type to Date Time.

Also Is there any possiblities to change the formula editor, just now I check 2 things , Tried with 1 # or 2 #

1# Record Selection

{CLARITY_TDL_VIEW.POST_DATE} in {?Select Start Denial Post Date} to {?Select End Denial Post Date}

by adding

ToTex({CLARITY_TDL_VIEW.POST_DATE}) in Totext({?Select Start Denial Post Date}) to ToText({?Select End Denial Post Date})

2# Forumla Field for >>>>> Reason

if isnull({CLARITY_RMC.REMIT_CODE_NAME}) then "UNKNOWN REASON"

else ({CLARITY_RMC.REMIT_CODE_NAME}) + " - " +

totext({CLARITY_RMC.REMIT_CODE_ID},0,"")

by Removing totext

if isnull({CLARITY_RMC.REMIT_CODE_NAME}) then "UNKNOWN REASON"

else ({CLARITY_RMC.REMIT_CODE_NAME}) + " - " +

{CLARITY_RMC.REMIT_CODE_ID}

But I don't know What exactly is happening >>> just did by reading some forums.

Former Member
0 Kudos

Well as long as you can see that CR is recognizing it as a date you should be fine you can change data types in CR. This is info that is supplied to CR by the database driver.

Don't convert your dates to text in the formula. CR won't process correctly unless it sees all 3 values as Date or DateTime.

Former Member
0 Kudos

Can you please provide me the info where I can change the Field Type in CR.

After converting in totext now I can see some data but let me know whether I going the right path or not ??

What exactly totext do's ??

If I convert the field type in CR to date time, will it work fine or do I need to change in the forumla too ??

Please suggest me, I am bit confused.

Thanks

Former Member
0 Kudos

You can't actually change a field type in CR. You can make CR treat a field type like a different field try by using a formula... Which is what you are doing when you use the ToText function.

No converting dates to text (using the ToText function) IS NOT the right path to go down. If you are trying to find dates that fall between to dates, then you need to keep everything as dates.

Jason

former_member292966
Active Contributor
0 Kudos

Hi,

First of all are your parameters Date as well? In the Field Explorer, right-click CLARITY_TDL_VIEW.POST_DATE and select Browse Data from the menu. At the top of the browse window, you should see the type. Is this Date as well? If they field and parameters don't match this will happen.

Secondly your formula is syntactically incorrect. I think this is the cause of your error. You need to have [ ] brackets around your date range like:

{CLARITY_TDL_VIEW.POST_DATE} in [{?Select Start Denial Post Date} to {?Select End Denial Post Date}]

Hope this helps,

Brian

Former Member
0 Kudos

sounds lilke you parameters are set up as a string field

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi R,

Please check the format you are receiving date in. If the date format is DD/MM/YYYY, Crystal does not recognize it as a date and you will have to use the MID, LEFT & RIGHT functions to break the date and rearrange it in MM/DD/YYYY format before you can use the cdate function.

Thanks & regards,

Manu.

Former Member
0 Kudos

Thanks for replying me, Please let me where to check the format where I am new to CR. Is it in the Back end, If it is on the back end then how to convert it ??

Will the ToText and Cstr functions works to convert ??

Thanks in advance again.....

Former Member
0 Kudos

Hi R,

What is the back end you are working with? Is the Crystal Report built on a BEx query?

Thanks & regards,

Manu.

Former Member
0 Kudos

The back end is SQL Server 2008, Just now I check in the back end for the Post Date is entered as 2006-12-31 00:00:00.000 format.

Former Member
0 Kudos

Try using CDate(string) and if that doesn't work try CDate(YYYY,MM,DD)