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
LVL 1
Tina KSystems SpecialistAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
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
0
mlmccCommented:
If you need the numbers as numbers for another formula create the one I modified and use it in the display.

mlmcc
0
James0628Commented:
You may want to add ,0 to the last CStr function in mlmcc's formula, for consistency.  If you look at CStr in the CR Help, that should explain the arguments that you can give it to control the formatting of the values in the string.

 James
0
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Tina KSystems SpecialistAuthor Commented:
@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!
0
Tina KSystems SpecialistAuthor Commented:
I should add that I did change formula #2 by adding tonumber - still generating the string is non-numeric error
0
mlmccCommented:
I assume you are trying to display a value on the report and want it to be either a numeric result or a word.  So for display purposes use this formula
Name - DispFromDate
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},0)
 default : "QUOTED"

Open in new window


For calculations use this one
Name- CalcFromDate
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

Open in new window


If you don't want 0 to be the default change it or use
whileprintingrecords;
 select {@cru}
     case "cru hr", "cru hr %" : {Command.HR_FromDate}
     case "cru gv" : {Command.GV_FromDate}
     case "cru cr" :  {Command.CR_FromDate}

Open in new window


mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.