cancel
Showing results for 
Search instead for 
Did you mean: 

Script to Call a Data Flow in a loop using a Process in CPI-DS

aourzy_ankur
Discoverer
1,171

I would like to write a script to increment value of a Global Parameter by 1 and when it reaches a number say 10 then Stop the process further.

How do I frame my script ?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Global Variable: $G_TIME_LOOP , integer, initial value = 1

Script Before dataflow:
print('Loop number = ' || $G_TIME_LOOP);

Script After:

IF
($G_TIME_LOOP = 10)
begin
print('Loop finish number = ' || $G_TIME_LOOP);
raise_exception_ext('JOB FINISH', 0);
end
else
begin

$G_TIME_LOOP = $G_TIME_LOOP+1;
end;

0 Kudos

Hi nikhaenko,

It would be really helpful if you could help me with this scenario. I am trying to achieve the same by following your syntax however I am not getting the results as expected. The process is running but not getting into the loop. It ends without even executing the dataflow once.

Thanks

Shubham

balazsbence95
Advisor
Advisor
0 Kudos

Hi shubham54498,

I cannot see any function provided that is capable of re-executing the task in a postload script.
The functions are listed here.

What you may try is using the exec() function to execute a command that triggers a task execution via runTask SOAP web service function. But somebody else here in this Community might have a better and sophisticated best practice for that.

Regards,
Bence

Answers (1)

Answers (1)

aourzy_ankur
Discoverer
0 Kudos

Thankyou Alexey that eased my work to quite a bit. I am able to optimise not one but many tasks.

sapsujit
Discoverer
0 Kudos

Could you tell me if this looping works? and share some screenshot of log how it looks.

kendw17
Explorer
0 Kudos
I tried a similar loop going from -1 to 0. It should have created two files. One with last months data and one with this months data. It ran for 1 second and produced no print message or files. Did you create the process with three flows in a circle does work?
kendw17
Explorer
0 Kudos
I created a new process and copied script 1 and script 2 exactly from above. The process started and finished without any print statement in the log or calling my data flow.