Variable value not updated when passed to custom task

Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
2 posts Page 1 of 1

jlous

Posts: 2
Joined: Wed Jan 14, 2015 9:14 am

Post by jlous » Tue Jan 20, 2015 8:50 am
Hi, we have an problem within a forEachLoop. A variable is updated from a record of the recordset itemsVariable used in the loop. We print its value with a print task and can see in the log it is updated for each record.
We also pass it to a custom task where we also log the passed variable, but here we see only the first value, but not the ones from the subsequent records.

Also in the custom task we log what the attributes we have in internalValidate()
1st run in the loop:
20-1-15 14:17:27 INFO Executing task 'print 1.0 (logTextSQL)'
20-1-15 14:17:27 INFO SQL statement : select TXT_XML CLOB1 from lxuvra where nr_ber = 78179124
20-1-15 14:17:27 INFO Finished task 'print 1.0 (logTextSQL)'
20-1-15 14:17:27 INFO getOracleCLOB Task started
20-1-15 14:17:27 INFO before expandVariables SQL is [select TXT_XML CLOB1 from lxuvra where nr_ber = ${curBerichtNr}]
20-1-15 14:17:27 INFO after expandVariables SQL is [select TXT_XML CLOB1 from lxuvra where nr_ber = 78179124]
20-1-15 14:17:27 INFO getOracleCLOB [select TXT_XML CLOB1 from lxuvra where nr_ber = 78179124]
20-1-15 14:17:27 INFO getOracleCLOB finished

2nd run in the loop
20-1-15 14:17:27 INFO Executing task 'print 1.0 (logTextSQL)'
20-1-15 14:17:27 INFO SQL statement : select TXT_XML CLOB1 from lxuvra where nr_ber = 78526229
20-1-15 14:17:27 INFO Finished task 'print 1.0 (logTextSQL)'
20-1-15 14:17:27 INFO getOracleCLOB Task started
20-1-15 14:17:27 INFO before expandVariables SQL is [select TXT_XML CLOB1 from lxuvra where nr_ber = 78179124]
20-1-15 14:17:27 INFO after expandVariables SQL is [select TXT_XML CLOB1 from lxuvra where nr_ber = 78179124]
20-1-15 14:17:27 INFO getOracleCLOB [select TXT_XML CLOB1 from lxuvra where nr_ber = 78179124]
20-1-15 14:17:27 INFO getOracleCLOB finished

It seems the setattribute does not get called at all after the first run. The second run there is no variable ${xyz} syntax present in the attribute text before expansion.

Is there something we need to do in the custom task to make this happen? Or is it a problem on the calling side of the custom task? I would not expect the latter, since the print task seems to work OK with the current variable value.

Cheers,
Joop

Support_Rick

Support Specialist
Posts: 590
Joined: Tue Jul 17, 2012 2:12 pm
Location: Phoenix, AZ

Post by Support_Rick » Mon Feb 02, 2015 9:39 am
Joop,

GADirector is an interpretive language .. so, in that instance (without seeing your Project XML) I would assume you're doing something like the following:

ForEach - MyData
SetValue: MyValue (MyData[3])
MyTask Parm1=Var1, Parm2=Var2, Parm3=MyValue
...
/ForEach

What happens is that in the Task Definition, the Task is being defined (interpreted) the first time through so, none of the subsequent iterations update.

To avoid this issue, create a "utility" project that calls your Task and pass the variables to that Utility Project to make the call. This way, every time the iteration goes through ... it will call the External Project and interpret based on the values being passed each time.

This should take care of your issue.
Rick Elliott
Lead Solutions Consultant
(402) 944.4242
(800) 949-4696
2 posts Page 1 of 1