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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Syntax problem

Status
Not open for further replies.

viatorg

IS-IT--Management
Jun 17, 2004
4
US
Hi all,

Sorry for re-post, I posted before in the wrong forum.

Having problem with the following crystal syntax. I's only
showing some of the records information, and not all. If I take away everything except just the last "if else" statement it seems to work fine.

Local StringVar status1 := {TempERCP.Status};
Local StringVar status2 := {TempERCP.Status2};
Local StringVar status3 := {TempERCP.Status3};
Local StringVar Diag1;


IF status1 = "proven" then
(
status1 := "";
Diag1 := " Diagnosis"
)
Else
(
status1 := Replace({TempERCP.Status},left({TempERCP.Status},1),uppercase(left({TempERCP.Status},1)),1,1);
Diag1 := " diagnosis"
);

IF status2 = "proven" then
status2 := ""
Else
status2 := {TempERCP.Status2};

IF status3 = "proven" then
status3 := ""
Else
status3 := {TempERCP.Status3};



IF NOT (isnull({TempERCP.Diagnosis})) and isnull({TempERCP.Diagnosis2}) and isnull({TempERCP.Diagnosis3}) then
status1 + Diag1 + " of " + {TempERCP.Diagnosis} + "."

Else if not (isnull({TempERCP.Diagnosis})) and not (isnull({TempERCP.Diagnosis2})) and isnull({TempERCP.Diagnosis3}) then
status1 + Diag1 + " of " + {TempERCP.Diagnosis}
+ " and a " + status2 + " diagnosis of " + {TempERCP.Diagnosis2} + "."

Else if not (isnull({TempERCP.Diagnosis})) and not (isnull({TempERCP.Diagnosis2})) and not (isnull({TempERCP.Diagnosis3})) then
status1 + Diag1 + " of " + {TempERCP.Diagnosis} + ", a "
+ status2 + " diagnosis of " + {TempERCP.Diagnosis2}
+ " and a " + status3 + " diagnosis of " + {TempERCP.Diagnosis3} + "."

thanks for your help
Gerry
 
When you say "only showing some of the records information", do you mean that you're only displaying your text string result for _some_ of the records, or for _all_ records, you're only displaying some of the text string you're trying to get, or both?

Might try adding semicolons after this line:

Diag1 := " Diagnosis"

and the other like it.

Also, your logic is heavily dependent on testing for NULLs, somake sure you're not converting NULL database values.



Jeff Prenevost
IS Administrator
Emergency Physicians Medical Group, PC
Ann Arbor, MI
 
The formula is only showing some of the records with the text string i included or it shows none when it should, on the report. If i remove everthing except the last "If else
statement and remove the variables from whats returned it
correctly shows the field data?

Still not working

thanks
Gerry
 
ok,

You were right about the null values. I changed the code around and it now works.

Local StringVar status1;
Local StringVar status2;
Local StringVar status3;
Local StringVar Diag1;


IF isnull({TempERCP.Status}) then
status1:=""
Else
IF {TempERCP.Status} = "proven" then
(
status1:= "";
Diag1 := " Diagnosis")

Else
( status1 := Replace({TempERCP.Status},left({TempERCP.Status},1),uppercase(left({TempERCP.Status},1)),1,1);
Diag1 := " diagnosis");


IF isnull({TempERCP.Status2}) then
status2:=""
Else
IF {TempERCP.Status2} = "proven" then
status2:= ""
Else
status2 := {TempERCP.Status2};


IF isnull({TempERCP.Status3}) then
status3:=""
Else
IF {TempERCP.Status3} = "proven" then
status3:= ""
Else
status3 := {TempERCP.Status3};



IF not (isnull({TempERCP.Diagnosis})) and isnull({TempERCP.Diagnosis2}) and isnull({TempERCP.Diagnosis3}) then
status1 + Diag1 + " of " + {TempERCP.Diagnosis} + "."

Else if not (isnull({TempERCP.Diagnosis})) and not (isnull({TempERCP.Diagnosis2})) and isnull({TempERCP.Diagnosis3}) then
status1 + Diag1 + " of " + {TempERCP.Diagnosis}
+ " and a " + status2 + " diagnosis of " + {TempERCP.Diagnosis2} + "."

Else if not (isnull({TempERCP.Diagnosis})) and not (isnull({TempERCP.Diagnosis2})) and not (isnull({TempERCP.Diagnosis3})) then
status1 + Diag1 + " of " + {TempERCP.Diagnosis} + ", a "
+ status2 + " diagnosis of " + {TempERCP.Diagnosis2}
+ " and a " + status3 + " diagnosis of " + {TempERCP.Diagnosis3} + "."


thanks for your help
Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top