Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If Then Else Statement syntax help on printing data

Status
Not open for further replies.

chiquee

Programmer
Mar 17, 2004
3
AU
Hello there.
I am a newbie to Crystal Reports Version 8.5.
I am retrieving a status code from the database via a Stored Procedure and I want to translate certain code to another "known" code and if its a finalised code to not display it at all.

I am a programmer and I know what I want to do but not the Crystal Report syntax which I've kind of been dropped in the deep end to do an enhancement and there aren't enough resources to help me learn.

To simply my problem I have written it in pseudocode so can anyone help. I'm putting this formula in the X-2 Suppress.


if({rsltStatus}= "F" OR {rsltStatus} = "N")

then suppress data/do not display at all/blank

else if ({rsltStatus}= "A" OR {rsltStatus} = "P")
display letter "I"

else if ({rsltStatus}= "I")
display letter "P"

end


I know cause I'm putting it in the Suppress X-2 it usually expects a boolean (ie true or false), I can't find the command to "display letter p in this field" ie translate it. or get it to work with boolean and print statements.

Can someone suggest any ideas?

Thanks ahead.
 
I'll get back to you about the exact syntax, but you don't shouldn't do this in the conditional supress section, but instead create a formula with "" when you want the blank/
 
if {rsltStatus}="F" or {rsltStatus}="N" then ""
else if {rsltStatus}="A" or {rsltStatus}="P" then "I"
else if {rsltStatus}="I" then "P"

Does this work in a formula field?
 
is this a formula in a field? IE. It it a formula field that you want the value displayed to be " ", "I" or "P".

Or is this a formula to suppress a row or specific formula.

It sounds like the former to me.

Also, IS {rsltStatus} a field in your database? or is it a parameter in your associated application? If it is a Parameter in your application then you must assign the value to a Crystal parameter and pass this into the report.

if this is a formula field with the results being a diplay of " ", "I" or "P" then this will work.

WhilePrintingRecords;
StringVar result ;

if {rsltStatus}= "A" OR {rsltStatus} = "P" then
result := "I"
else if ({rsltStatus}= "I" then
result := "P"
else
result := " "; // this also serves as a default for bad data

result;

This should work ok.

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Thanks all for ur suggestions, I was manically trying everything. I will try them out now and get back to if it worked or not.

Cheers,
 
Hi all,
It worked!!
Thanks all for helping me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top