Hello,
Since Ebase does not provide parallel tasks function (form sent to multiple approver at the same time and collect reply from each of approver). We need to create sub job for each approver for this case.
We can create sub job, however, we need to access result and data from sub job from the parent job, is there a way by using ebase functions?
Thanks,
Xiaoli
access sub job and data from sub job
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 272
- Joined: Fri Dec 14, 2012 2:55 pm
- Location: Ottawa
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
I'm guessing when you say "sub job" that the main "parent" workflow process is starting a number of additional workflow processes ("sub-jobs"). In this case the parent process needs to do two things:
1. wait for all spawned processes to end
2. read the feedback
This is quite difficult to implement - I think you will have to use database tables as a means of communication. In overview, each spawned "sub-job" would update the database with its results. The parent job would start all the sub-jobs then move on to a Pause Node that wakes up periodically and checks the database waiting for all sub-jobs to complete.
In detail you would need to do something like this: the parent job assigns a unique key to each sub job (this is just a means of telling the sub-jobs apart so it could just be an integer). The parent job writes initialising records to the database for each sub-job e.g. if there are 5 sub-jobs, it would write 5 records to the database with the status of each sub-job set to active. You will also need to pass some sort of unique key representing the parent key and write this to the database - this could be the parent's job id or you could use an Ebase sequence. Having started all sub-jobs and written the records to the database, the parent moves on to a Pause Node where it checks periodically for all sub-jobs to complete. Each sub-job performs its work then updates the database with the results and sets its status to completed. Eventually all sub-jobs will complete and this will be picked up by the Pause Node which will then end. The process then moves on to a system task that reads the results of all the sub-jobs from the database and processes it.
The SQL issued by the Pause Node will then be something like:
When this returns 0, all sub-jobs have completed and the Pause Node can end.
Hope this is understandable.
1. wait for all spawned processes to end
2. read the feedback
This is quite difficult to implement - I think you will have to use database tables as a means of communication. In overview, each spawned "sub-job" would update the database with its results. The parent job would start all the sub-jobs then move on to a Pause Node that wakes up periodically and checks the database waiting for all sub-jobs to complete.
In detail you would need to do something like this: the parent job assigns a unique key to each sub job (this is just a means of telling the sub-jobs apart so it could just be an integer). The parent job writes initialising records to the database for each sub-job e.g. if there are 5 sub-jobs, it would write 5 records to the database with the status of each sub-job set to active. You will also need to pass some sort of unique key representing the parent key and write this to the database - this could be the parent's job id or you could use an Ebase sequence. Having started all sub-jobs and written the records to the database, the parent moves on to a Pause Node where it checks periodically for all sub-jobs to complete. Each sub-job performs its work then updates the database with the results and sets its status to completed. Eventually all sub-jobs will complete and this will be picked up by the Pause Node which will then end. The process then moves on to a system task that reads the results of all the sub-jobs from the database and processes it.
The SQL issued by the Pause Node will then be something like:
Code: Select all
select count(*) as active_sub_jobs from xxxxxxx where parent_id=parent_job_id and status='Active'
Hope this is understandable.
0 x
Who is online
Users browsing this forum: No registered users and 1 guest