Link to home
Start Free TrialLog in
Avatar of Tina K
Tina KFlag for United States of America

asked on

Cyrstal Reports data type in Case Statement

I've tried just about everything I can think of.  The formula below works awesome, however;  I would like the default to be 'Quoted' not 0.00  As we all know, CR cannot mix data types.  The hr_fromdate, gv_fromdate and cr_fromdate are integers (not date fields, not sure why they were named that way...)   Any thoughts on how I can force CR to display a string rather than a number as default?  Thanks so much!  

whileprintingrecords;
select {@cru}
    case "cru hr", "cru hr %" : {Command.HR_FromDate}
    case "cru gv" : {Command.GV_FromDate}
    case "cru cr" : {Command.CR_FromDate}
default : 0.00
Avatar of Mike McCracken
Mike McCracken

Try converting the numbers to strings

 whileprintingrecords;
 select {@cru}
     case "cru hr", "cru hr %" : CStr({Command.HR_FromDate},0)
     case "cru gv" : CStr({Command.GV_FromDate},0)
     case "cru cr" : CStr({Command.CR_FromDate})
 default : "QUOTED"

Open in new window


mlmcc
If you need the numbers as numbers for another formula create the one I modified and use it in the display.

mlmcc
SOLUTION
Avatar of James0628
James0628

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tina K

ASKER

@mimcc - the formula works great with the addition of the cstr function, but you're right, I do need the numbers as numbers for another formula.  I don't understand what you mean by "create the one I modified and use it in the display"  The other formula that uses the result of this formula is generating the error 'the string is non-numeric'.

Thanks!
Avatar of Tina K

ASKER

I should add that I did change formula #2 by adding tonumber - still generating the string is non-numeric error
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial