Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

job recursive calls

Hello,
How can I call recursively a job (TOS 3.0.4) ?
The component tRunJob does not allow calling the job in which the component is used.
I want to do something like :

MyRecursiveJob =
+subJob1
|
|
OnSubJobOK
|
|
+tDBInput ---If (tMSSqlInput_NB_LINE >0) ---> tRunJob_1(MyRecursiveJob)

Is there a simple way to do that ?

Thanks
Labels (2)
7 Replies
Anonymous
Not applicable

Hello,

yes you can :

1) Create a job that call your "MyRecursiveJob"
2) Call this job from MyRecursiveJob !

But isn't the better way. Are you sure to need to use recursivity ? be aware with memory and exit condition.
Anonymous
Not applicable

Hi,
I would like to use recursive calls too, to be able use a hierarchy table with this kind of structure :
hierarchy_table(id_parent number, id_child number)
like the nodes of a tree...
I've been looking several ways with the loop component, but i did not find any solution.
I'm not asking you to do my job, but do you have any idea of how to make easy and not so heavy for the memory, or do i have to use job calls like you explained before?
Just for information, i'm using TOS 3.0.5 with Java and a MySQL 5 db,
Thanks and have a nice day...
Anonymous
Not applicable

Hi,
first: did anyone tried Menuet solution? I think this is not possible because different variables are defined as static. This will lead in many problems. This is, from my point of views, a big design issue. So you need to transform your recursive call to an loop. This should (theoretical) always be possible.
If you give some more information about your job, we could try to help you out 0683p000009MA9p.png
Bye
Volker
Anonymous
Not applicable

Sorry I forgot to give you some feedback.
Here it is :
I tried emenuet's solution but it did not work (can't remember the error but when I cliked on the run button I got an error message before the process really started).
Anyway you were right, it was possible to avoid this recursive call with a loop and a global variable.
Thanks
Fred
_AnonymousUser
Specialist III
Specialist III
Author

Hello,
Can anybody post the answer here?
MyRecursiveJob =
+subJob1
|
|
OnSubJobOK
|
|
+tDBInput ---If (tMSSqlInput_NB_LINE >0) ---> tRunJob_1(MyRecursiveJob)


I have the same problem, and I do not know how to create and call a recursive job.
Thanks in advance.
Anonymous
Not applicable

I think the answer to this question is to use tLoop.
tLoop(Iterate)->tRunJob(OnSubJobOK)->SubJob
Where SubJob is your logic to determine if the loop should end.
And maybe adding a Thread.sleep() before the next iteration of the loop may be useful.
This is iteration not recursion.
_AnonymousUser
Specialist III
Specialist III
Author

Thank you tal00000 !

It is helpful, I use an iteration and it works.

tLoop--->iterate--->myChildJob

I retrieve the value returned by myChildJob and check it in the tLoop condition (while).

Regards,