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

Crystal 8.5 Nested if formula will not work in Crystal 10 1

Status
Not open for further replies.

QueTech

MIS
Apr 13, 2003
79
US
I am using Crystal 10 on Win XP machine. I pulling data from a Cashe database. I have converted a Crystal 8.5 report to Crystal 10. The report and the formula will work in Crystal 8.5 but the same formula will not run in Crystal 10. When I open the report I immediately get the message that "The saved data will be discarded since one or more of the formulas will not compile." When I ok through that message I am able to enter the three parameters need to run the report. I am then thrown into the formula editor where the first "else" in my statement is highlighted and the message box states "The ) is missing." I check the structure of the nested if several times and cannot see where a ")" is needed. Please find below the nested IF statement. Any suggestions will be appreciated.

whileprintingrecords;
shared numbervar ProdUnitsGrp;
numbervar Mins := Maximum ({tx_history_all.service_duration}, {tx_history_all.SERVICE_CODE});
shared numbervar UnitsGrp;

if {service_code_table.cluster_code} in ['11', '21', '22', '27', '40', '41'] then
(if {@CPT Eligible} = 'Y' then
if {tx_history_all.SERVICE_CODE} in ['P102', 'P108', 'P109', 'P130', 'P131', 'P133' TO 'P139', 'P142', 'P208', 'P209', 'P9805', 'PM108', 'PM109', 'PM208', 'PM209'] then
select Maximum ({tx_history_all.service_duration}, {tx_history_all.SERVICE_CODE}) case 0 to 19 : Mins := 0
case 20 to 44 : Mins := 30
case 45 to 74 : Mins := 50
default : Mins := 80;
else
if {service_code_table.cluster_code} = '32' then
(if remainder(Maximum ({tx_history_all.service_duration}, {tx_history_all.SERVICE_CODE}), 15) = 0 then
Mins := Maximum ({tx_history_all.service_duration}, {tx_history_all.SERVICE_CODE})
else
if remainder(Maximum ({tx_history_all.service_duration}, {tx_history_all.SERVICE_CODE}), 15) < 8 then
Mins := Int(Maximum ({tx_history_all.service_duration}, {tx_history_all.SERVICE_CODE}) / 15) * 15
else
Mins := (Int(Maximum ({tx_history_all.service_duration}, {tx_history_all.SERVICE_CODE}) / 15) + 1) * 15)
else
Mins := Mins
else
if remainder(Maximum ({tx_history_all.service_duration}, {tx_history_all.SERVICE_CODE}), 15) = 0 then
Mins := Maximum ({tx_history_all.service_duration}, {tx_history_all.SERVICE_CODE})
else
if remainder(Maximum ({tx_history_all.service_duration}, {tx_history_all.SERVICE_CODE}), 15) < 8 then
Mins := Int(Maximum ({tx_history_all.service_duration}, {tx_history_all.SERVICE_CODE}) / 15) * 15
else
Mins := (Int(Maximum ({tx_history_all.service_duration}, {tx_history_all.SERVICE_CODE}) / 15) + 1) * 15;

ProdUnitsGrp := Mins / 60;

UnitsGrp := UnitsGrp + ProdUnitsGrp;

ProdUnitsGrp;)

else
ProdUnitsGrp := ProdUnitsGrp;
UnitsGrp := UnitsGrp;
 
Try adding the paren at the end of the case statement:

default : Mins := 80
);

Apparently in some instances, the select case function requires an extra closing paren, even though it means there is not a corresponding open paren.

-LB
 
Hey,

Thanks for the reply, when implement your suggestion. I get the message that the remaining text does not appear to be apart of the formula. The text highlighted is from the first "else" all the down.
 
Actually, on second thought, try just removing the ";" after the default, so that it reads:

default : Mins := 80
else

If that doesn't wor, then try:

default : Mins := 80
) else

-LB

 
I deleted the ";" semicolon and that seems to have fixed the problem. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top