local variables inside dataflow

Hi,

Can anybody explain me how can we use local variables inside a dataflow?


p.sree (BOB member since 2009-06-15)

By adding a column.

What is it you really want to accomplish?


Werner Daehn :de: (BOB member since 2004-12-17)

i need to pass a column value for each row through a variable inside a workflow. then process that value and put it in target.


p.sree (BOB member since 2009-06-15)

What is the content of this variable? How does it get set? Is the value different for every row? Are you expecting the workflow will do something for each row once? Why has this to be done in the workflow?

In general it is simple, you define a variable in the workflow, a parameter in the dataflow, then you go back to the workflow and set the parameter to the value of the variable in the “calls” tab of the variables-and-parameters window. Now the dataflow has the value in its parameter and you can us it inside the dataflow, e.g. load it into the target.


Werner Daehn :de: (BOB member since 2004-12-17)

Exactly, my doubt is, how to set this variable value? i mean, i created a variable, then passed it in the parameter in calls tab, but whr to set this variable’s value? i want to pass a particular column value from source for each row in the variable… hope u r getting my point…


p.sree (BOB member since 2009-06-15)

Let me rephrase your question.

You have a BASIC program called “workflow” and inside you call a sub-procedure. This sub-procedure named “dataflow” has one input parameter passed into it. All the sub-procedure “dataflow” is doing is a for-next loop.

How can I return a value back to the “workflow” main procedure for every iteration of the for-next block?

As said, what is it you want to accomplish?


Werner Daehn :de: (BOB member since 2004-12-17)

I really thank you for answering my queries :slight_smile:

but i think am not very clear…

see, lets say i want to implement cumulative sum i.e

src data -
1,10
2,20
3,30 … okey…

output i want as
1,10
2,30
3,60

thr are many ways in which this can be implemented, but if i want to use a variable here, like we can do in INFA…

my mapping will have

source -> query -> target

i want to pass, 10, 20 , 30 values from the source in a local variable and process them inside a query transform inside the dataflow and load the target…

now what i am doing is… i am creating a local variable, creating a parameter, assigning the parameter with the local variable value in the calls tab and accessing it inside the query transform of the dataflow…

BUT, my doubt is, how do i pass value to the local variable itself , am not assigning it any value anywhere right???

Hope i am clear now…

Or else, can u give me an example to implement local variables?


p.sree (BOB member since 2009-06-15)

You use a custom script function for that with input/output parameters.

Or you do this: https://wiki.sdn.sap.com:443/wiki/display/BOBJ/Cumulative+Sum


Werner Daehn :de: (BOB member since 2004-12-17)

Hey thanks :slight_smile:


p.sree (BOB member since 2009-06-15)