Page 1 of 1

assign multiple derivations in a transformer

Posted: Thu Dec 21, 2006 11:46 am
by seanc217
Hi there,

I was wondering if you could do something like this in a transformer:

if x =1 then
a = "1"
b = "2"
else
c="3"


The key being the multiple assignemnt of a and b.

Hope that's clear.

Thanks

Posted: Thu Dec 21, 2006 12:01 pm
by kcbland
Use stage variables.

Posted: Thu Dec 21, 2006 1:39 pm
by johnthomas
I dont think the assignment statement will be valid .write seperate derivations for each variables else you should be getting the expression in
red color :x

Posted: Thu Dec 21, 2006 1:44 pm
by DSguru2B
No. Multiple assignments are not allowed. As Ken pointed out, use stage variables. Feel free to use as many for as many assignments.

Posted: Thu Dec 21, 2006 2:42 pm
by ray.wurlod
Beware that you must assign a value irrespective of the test. So you need to decide values for variables a and b when x <> 1, and for c when x = 1. Sometimes you need to leave the value unchanged; in this case assign the stage variable to itself. For example, consider a stage variable svCounter that counts the product codes. It might be initialized to 0. The it might be derived as

Code: Select all

If svProdCodeChanged Then svCounter + 1 Else svCounter