Declarations and Syntax

make

Member
Hi,

i have made the following :

def var counter1 like xauf.stk.
def var counter2 like xauf.val.

now i want to do this.

When a special var (namend :"Scan") is 1 then the var result should be counter1. When "Scan" is 2 then rsult should be counter.
When Scan is 1 then result = counter1
When Scan is 2 then result = counter2

I dont know how i have to make the declarations vor result and the Syntax is !

Thanks for help
make
 

Crittar

Member
Make,

Try this:

def var counter1 like xauf.stk.
def var counter2 like xauf.val.
def var result as integer no-undo.

case scan:
when 1 then
assign result = counter1.
when 2 then
assign result = counter2.
end case.

Note: This assumes that counter1 and counter2 are both integer variables, if they are not then you will have to define result accordingly.
 

jongpau

Member
Hi Make,

You can accomplish it without the case statement as well when done as follows:
Code:
assign result = if scan eq 1 
                then counter1
                else counter2.
 
Top