Page 1 of 1

Variables...

Posted: Fri Oct 25, 2002 1:40 am
by rasi
Hi,

I want to know which is the best way to solve the following problem:

I want to get the max number from a sequence meta table and store in a variable. And then use the same value to a different stage variable.

thanks
rasi

Posted: Fri Oct 25, 2002 5:53 pm
by ray.wurlod
SELECT MAX(columnname) FROM sequencemetatable;
Take the results of this query (for example from an ODBC stage) into a hashed file containing one row and two columns. The other column is the key column, and contains a constant value (let's call it "1"). Use a reference input link from this hashed file to load the stage variable in the first Transformer stage. The reference key expression is "1". (The returned value will be the same for every row processed, but that's what you want, presumably.) In fact, you may not even need a stage variable here, because the value is available from a reference input link column.
Derive an output column (called, say, MaxValue) from this stage variable or reference input link column, and use that column to load the stage variable in the second Transformer stage.