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!

Report painter if statement

Status
Not open for further replies.

stevepikon

Programmer
Oct 7, 2002
6
0
0
BE
Hello

In report painter I've got a report in which some rows are dependent on the selected company code.

I'd like to add some logic to these rows, but it seems that only one if-statement is allowed, and that I cannot use a nested if-statement. Does anybody know how I can add the following logic to a row in a report painter report?

IF '&YCOMPA' = 0300 THEN ( Y025 / 122 )* 22
ELSEIF '&YCOMPA' = 0702 THEN ( Y025 / 125 )* 25
ELSEIF '&YCOMPA' = 0708 THEN ( Y025 / 125 )* 25
ELSEIF '&YCOMPA' = 3066 THEN ( Y025 / 125 )* 25
ELSEIF '&YCOMPA' = 7082 THEN ( Y025 / 124 )* 24
ELSE ( Y025 / 117.5 )* 17.5

explanation:
&YCOMPA = the company code selected by the user
Y025 = another row on which a multiplication is done, dependent on the selected company code, to derive the value of row

Thanks

 
Steve,


Can't you use a case statement :

CASE '&YCOMPA'.
WHEN 0300. ( Y025 / 122 )* 22.
WHEN 0702. ( Y025 / 125 )* 25.
WHEN 0708. ( Y025 / 125 )* 25.
WHEN 3066. ( Y025 / 125 )* 25.
WHEN 7082. ( Y025 / 124 )* 24.
WHEN OTHERS. ( Y025 / 117.5 )* 17.5.
ENDCASE.

Maybe the problem lies in the fact that there is no valid statement in your THEN clauses of your IF statement.
Nothing is returned and no variable is assigned a new value.
FI : The expression '( Y025 / 122 )* 22' seems incorrect.
What do want to do with the result ? Do you want to assign it to another variable ? If so then try this :
'RESULT = ( Y025 / 122 )* 22.'

Regards,
Fred
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top