I am having trouble with the values of Stage variables being retained from one row to the next. In Server this always worked, but in PX the variables all seem to be reset to zero or null as each row is processed.
example 2 varables:
VarSave integer(10) initial value 0
Var1 integer(10) initial value 0
In stage variables:
1st VarSave set to Var1
2nd Var1 set to input.column1
2 rows input:
column1
1
2
output
input.column1
VarSave
Var1
results:
1
0
1
nothing wrong with first row
second row results:
2
0
2
VarSave should have retained the 1 from the first row but did not.
I was looking for:
2
1
2
Using Stage Variables in PX vs. Server
Moderators: chulett, rschirm, roy
Using Stage Variables in PX vs. Server
Michael Favero
2852 Humboldt Ave So
Minneapolis, MN 55408
2852 Humboldt Ave So
Minneapolis, MN 55408
The only thing I can think of is that each row is being processed separately in parallel. Therefore each row will read the initial value as 0 at the same time. I would be interested to see what your outputs were when you used more rows, as I would expect to see the VarSave value to start counting up when there are multiple rows processing on the node.
The only way to ensure that all rows are passed through the variables would be to run the transformer in sequential mode rather than parallel.
The only way to ensure that all rows are passed through the variables would be to run the transformer in sequential mode rather than parallel.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
You can still use stage variables. For a counter just use some of the PX specific macros that give you the number of threads and thread number. For remembering values just match the partitioning to the key fields, think of it as a multiple instance job, partition by the right field and you can still compare values between rows in a way that makes sense.
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn