PDA

Click to See Complete Forum and Search --> : crystal report XI string is required


nudge
Oct 27th, 2008, 11:35 PM
Good morning ,,

I've been through an error that is really driving me crazy since two days ..
I tried to solve it ..
No way !!

I have an error in my crystal report (report) .. each time I tried to run that report ..
am getting an error saying : a string is required here .. after i click ok .. i see myself in the formula workshop ..
with an error saying : if not isNull({@StartDate}) and {@StartDate} = 2.00 then 128 else
DefaultAttribute;

StartDate is a datetime field in my DB .. and am converting it to a text here ..

the syntax for converting am using is : totext(StartDate({vwTiming.StartDate}),"HH:mm")

I'm using crystal report XI


I really don't understand what is the problem ..

rasinc
Oct 28th, 2008, 05:35 AM
I think your problem may be that the 128 is a number and may need to be a string based on the field. You are using DefaultAttribute so if the default resolves to a string then the "then" portion of your If statement must be string also.

Now, the DefaultAttribute is usually found when you are doing conditional formatting like changing fonts based on the values of a field, etc. So if you are changing from Regular to Bold, then the default may be Regular which is a string. So maybe if the words DefaultAttribute are not in the Functions area of the Formula Workshop then you may need to find something else for the Else.

Hope this helps

nudge
Oct 29th, 2008, 04:27 AM
emmmm ..
still not getting it :(

what do i really need to change!?

rasinc
Oct 30th, 2008, 09:32 PM
Assuming @StartDate is the formula
totext(StartDate({vwTiming.StartDate}),"HH:mm")

Try

if not isNull({@StartDate}) and {@StartDate} = "2.00"

Since @StartDate resolves to a text value you need to compare it to a text value, not a number.

nudge
Nov 9th, 2008, 12:47 AM
Assuming @StartDate is the formula
totext(StartDate({vwTiming.StartDate}),"HH:mm")

Try

if not isNull({@StartDate}) and {@StartDate} = "2.00"

Since @StartDate resolves to a text value you need to compare it to a text value, not a number.


where should I try ur code??

and what do you mean by comparing ..!?
am not comparing it to a number ..

there error: string is reqired here,, is showing for a font color ..!
but I don't know how to fix it !!