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

Syntax

Status
Not open for further replies.

sabeeha08

MIS
May 5, 2010
18
GB
CR 8.5

Hi Can any body tell me if there is anything wrong with this syntax



whileprintingrecords;
numbervar a;

if {@ccrsgrp} = 1 then

select a
case 1 : "Taught course part time"
case 2 : "Revision"
case 4 : "Revision"
case 20 : "Distance learning"
case 40 : "Distance learning"
case 100 : "Online Classroom"
case 200 : "Check in X3";

else if {@ccrsgrp} > 1 and a = 1 then "Taught course part time"
else if {@ccrsgrp} > 1 and a = 2 then "Revision"
else if {@ccrsgrp} > 1 and a = 20 then "Distance learning"
else if {@ccrsgrp} > 1 and a = 100 then "Online Classroom"
else if {@ccrsgrp} > 1 and (a>2 and a<10) then "Taught course and revision"
else if {@ccrsgrp} > 1 and (a>100 and a<200) then "Online Classroom"
else if {@ccrsgrp} > 1 and (a>20 and a<100) then "Distance learning and revision" ;
 
If it works then I guess its OK!

If not what errors are you getting?

What are you trying to do as this part does not look like it will work

select a
case 1 : "Taught course part time"
case 2 : "Revision"
case 4 : "Revision"
case 20 : "Distance learning"
case 40 : "Distance learning"
case 100 : "Online Classroom"
case 200 : "Check in X3";

the ; at the end will break the if..then.. else causing whole thing to fail.

Ian
 
error, says the remaining text does not appear to be part of the formula.

it actually works when i run it on crystal on it own, but when i deploy the report in our ERP apps then i get the error

i calculate a distinct sum to get this value {@ccrsgrp}

and if it meets the criteria i am allocating it using a case statement

thanks
 
If it works in Crystal 8.5 then it should work in your ERP system. Are you sure the ERP system is using 8.5?

Ian
 
So you are establishing the value of "a" in another formula?

-LB
 
That's correct Ibass, I have changed it to the following now and it seems to be working, not sure why the orginal did not work


whileprintingrecords;
numbervar a;

if {@ccrsgrp} = 1 and a =1 then "Taught course part time"
else if {@ccrsgrp} = 1 and a =2 then "Revision"
else if {@ccrsgrp} = 1 and a =4 then "Revision"
else if {@ccrsgrp} = 1 and a =20 then "Distance learning"
else if {@ccrsgrp} = 1 and a =40 then "Distance learning"
else if {@ccrsgrp} = 1 and a =100 then "Online Classroom"
else if {@ccrsgrp} = 1 and a =200 then "Check in X3"


else if {@ccrsgrp} > 1 and a = 1 then "Taught course part time"
else if {@ccrsgrp} > 1 and a = 2 then "Revision"
else if {@ccrsgrp} > 1 and a = 20 then "Distance learning"
else if {@ccrsgrp} > 1 and a = 100 then "Online Classroom"
else if {@ccrsgrp} > 1 and (a>2 and a<10) then "Taught course and revision"
else if {@ccrsgrp} > 1 and (a>100 and a<200) then "Online Classroom"
else if {@ccrsgrp} > 1 and (a>20 and a<100) then "Distance learning and revision"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top