assign multiple derivations in a transformer

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
seanc217
Premium Member
Premium Member
Posts: 188
Joined: Thu Sep 15, 2005 9:22 am

assign multiple derivations in a transformer

Post 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
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Use stage variables.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
johnthomas
Participant
Posts: 56
Joined: Mon Oct 16, 2006 7:32 am

Post 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
JT
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply