Skip to Content
0

Variable set within function is not passing between dataflow and workflow

Oct 30, 2017 at 12:21 PM

65

avatar image
Former Member

I have a parameter that gets set within function call within Dataflow. The result also gets written to table within the dataflow so I can see that the parameter is filled correctly. The parameter is defined as an 'out' parameter within dataflow.

In workflow that calls this dataflow I assign this out parameter to a local variable. In a script after the dataflow call I print the local variable. It prints NULL.

Somehow this variable is overwritten. Any ideas as to why the parameters are not passing appropriately?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Arun Sasi Nov 02, 2017 at 05:19 AM
1

Hi Corne,

The scope of the parameter will always remain within the workflow and dataflow.

Here is the work flow which I used

Lets assume I want to use Local Variables and parameters in the below Manner

Job> Work Flow>Data Flow followed by Script

1) Double click the Work Flow and Declare the Local variable and Parameters in Definitions tab Under Tools>Variables.


Pass the Parameters at the Work flow level inside the Calls tab. Here my Parameter is of type Input.Here when I say work flow you need to click the Work Flow and go inside it i.e Context of Work Flow(highlighted)

3) Go to the Data flow inside the work flow and declare the parameters inside the Definitions tab. These are the parameters which are going to be passed to the Data flow

Here were are in Context of Data Flow(Highlighted)

3) Declare the required Local Variables at the job level inside the Definitions Tab.

Pass the Local variable to the parameters at the Job level inside the Calls tab. The local variable needs to be initialized at the start of the job inside a script.

E.g. $L_CurrentTimeStamp = sysdate();

Now if I pass my Input parameter $P_CurrentTimeStamp to a local variable inside a script after the data flow it should print the value correctly

Regards

Arun Sasi


pb99r.png (9.4 kB)
as1oh.png (10.5 kB)
bltjm.png (8.5 kB)
k77pi.png (8.5 kB)
qyycf.png (10.5 kB)
Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi, unfortunately this is exactly what I did. What I did add based on your suggestion is to initialize the local variable at start. It just prints out what I initially set it to.

0

Excellent!!

0
Dirk Venken
Oct 30, 2017 at 02:41 PM
0

I am afraid you're running into a limitation of the software. I have never tried what you're doing. But I've had exactly the same problem when working with global variables.

You can assign a value to a global variable in a function. Works fine when you call the function from a script. The new value is available after the call. But when you call it from within a data flow, it is not.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks, but I don't understand why it is limitation of software. Dataflows have the functionality to have 'out' parameters. This tells me that it should be able to return a parameter that is set within the dataflow. I don't know many options of setting a parameter within a dataflow but surely setting the parameter within a query transform should do this?

Are there any other options of setting a parameter within a dataflow, perhaps I can try this.

0

The other option would be to use a global variable. But as that doesn't seem to work either...

0