I Have four processes which are all executed from another 'MAIN PROCESS'. The last process of the four updates attributes based on other attributes which are modified from the first process which was called. When I execute the main process, the first process called updates the required attributes but when the last process is executed, it updates its attributes based on the original values of the attributes modified by the first process, not the updated values.
If I re-run the main process, it all executes as I would expect.
Hopefully the table below explains.
-----------------------------------------
PROCESS 1 - This process updates specific attributes in a BO
PROCESS 2 - N/A
PROCESS 3 - N/A
PROCESS 4 - This process should update its BO's attributes based on the updated attributes modified by PROCESS 1
------------------------------------------
The MAIN PROCESS above executes and PROCESS 1 BO attributes are updated as expected. PROCESS 4 BO Attributes are updated using the pre-updated attributes in PROCESS 1. If the MAIN PROCESS is executed again, PROCESS 4 BO attributes are updated correctly as expected.
Hope this is clear.
Regards
Process Execution
Re: Process Execution
this isn't clear yet...
Does the MAIN PROCESS have the BO in Context, and the 4 Processes are relying on the in-context values, or are the 4 Processes doing FINDs on their own?
Does the MAIN PROCESS have the BO in Context, and the 4 Processes are relying on the in-context values, or are the 4 Processes doing FINDs on their own?
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Process Execution
You need to do it as following:
Main
|---------> Call Process 1
|---------> Call Process 2
|---------> Call Process 3
|---------> Call Process 4
The main, should simply have 4 calls in it. Each process executes, releases the context before the next starts and everything should work.
Main
|---------> Call Process 1
|---------> Call Process 2
|---------> Call Process 3
|---------> Call Process 4
The main, should simply have 4 calls in it. Each process executes, releases the context before the next starts and everything should work.
Re: Process Execution
As far as I know, thats what I have but Process 4 does not return the expected values, it returns the values based on the output from Process 1 before Process 1 executed.
Process 1 simply finds records based on the find query then sets then sets the required attribute in the found records. Process 4 uses this attribute in its find query. Process 4 appears to use the original values before Process 1 executed.
Process 1 simply finds records based on the find query then sets then sets the required attribute in the found records. Process 4 uses this attribute in its find query. Process 4 appears to use the original values before Process 1 executed.
Re: Process Execution
Are you sure Process 1 is completed BEFORE Process 2, 3 and 4 are called from Main?Ewanm wrote:As far as I know, thats what I have but Process 4 does not return the expected values, it returns the values based on the output from Process 1 before Process 1 executed.
Process 1 simply finds records based on the find query then sets then sets the required attribute in the found records. Process 4 uses this attribute in its find query. Process 4 appears to use the original values before Process 1 executed.
In subsequent processes, do you do a Find again to retrieve the updated Object?
Another option is to do the following without doing find in subsequent processes.
1) Main finds the object and updates it. As if this was you process1
2) Main calls process2,3,4 and each time "Passes" the object to those processes.
Try this style.
Re: Process Execution
How do I make sure Process 1 is complete before proceeding to subsequent processes. I though processes are executed in order with one finishing before the next one starts. If it starts to process subsequent processes before Process 1 is complete, that could be my problem.
Each Process is working on different BO's so they all have their own Find statements.
Each Process is working on different BO's so they all have their own Find statements.
Re: Process Execution
It sounds like this is the best approach for your scenario.Another option is to do the following without doing find in subsequent processes.
2) Main calls process2,3,4 and each time "Passes" the object to those processes.
Tom - V8.8 build 3137 - MySql / PostGres
Re: Process Execution
I understand using that approach would be good provided I was working on the same BO in each process but Process 1 & 2 work on one BO and update the attributes they require. This works great.
Process 3 and 4 update attributes in another BO based on the updated attributes from the first BO.
I have tried this in two manners by calling the processes as follows
1)
Main Process A
|---Calls Process 1
|---Calls Process 2
Main Process B
|---Calls Process 3
|---Calls Process 4
If I execute Main Process A with an on-screen button then execute Main Process B with another button, this works OK
2)
Main Process A
|---Calls Process 1
|---Calls Process 2
|---Calls Process 3
|---Calls Process 4
If I execute Main Process A with an on-screen button then this does not work. If I press the button twice, it works.
I require to use the second approach as this will eventually be processed on a schedule.
Process 3 and 4 update attributes in another BO based on the updated attributes from the first BO.
I have tried this in two manners by calling the processes as follows
1)
Main Process A
|---Calls Process 1
|---Calls Process 2
Main Process B
|---Calls Process 3
|---Calls Process 4
If I execute Main Process A with an on-screen button then execute Main Process B with another button, this works OK
2)
Main Process A
|---Calls Process 1
|---Calls Process 2
|---Calls Process 3
|---Calls Process 4
If I execute Main Process A with an on-screen button then this does not work. If I press the button twice, it works.
I require to use the second approach as this will eventually be processed on a schedule.
Re: Process Execution
That means this should work fine (even for the schedule)
Main Process A
|--- Calls Process B
|--- Calls Process C
Sub Process B
|---Calls Process 1
|---Calls Process 2
Sub Process C
|---Calls Process 3
|---Calls Process 4
Main Process A
|--- Calls Process B
|--- Calls Process C
Sub Process B
|---Calls Process 1
|---Calls Process 2
Sub Process C
|---Calls Process 3
|---Calls Process 4
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Process Execution
Thanks but this does exactly the same as previously, I had to execute it twice.
Re: Process Execution
Wow,
Then I wish someone would tell me the WHY internally there is a difference between these:
1)
Main Process A
|---Calls Process 1
|---Calls Process 2
Main Process B
|---Calls Process 3
|---Calls Process 4
If I execute Main Process A with an on-screen button then execute Main Process B with another button, this works OK
and
3) Main Process A
|--- Calls Process B
|--- Calls Process C
Sub Process B
|---Calls Process 1
|---Calls Process 2
Sub Process C
|---Calls Process 3
|---Calls Process 4
this does not work. If I press the button twice, it works.
Then I wish someone would tell me the WHY internally there is a difference between these:
1)
Main Process A
|---Calls Process 1
|---Calls Process 2
Main Process B
|---Calls Process 3
|---Calls Process 4
If I execute Main Process A with an on-screen button then execute Main Process B with another button, this works OK
and
3) Main Process A
|--- Calls Process B
|--- Calls Process C
Sub Process B
|---Calls Process 1
|---Calls Process 2
Sub Process C
|---Calls Process 3
|---Calls Process 4
this does not work. If I press the button twice, it works.
Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.
Jaymer
Aware Programming & Consulting - Tampa FL
Jaymer
Aware Programming & Consulting - Tampa FL
Re: Process Execution
It might help, at least for me, to post the code for your processes.
From an earlier post.
This is not true because changes to the database do not get committed until all processes complete, so Process 4 is finding the original values.
The reason executing the Main Process again works might be because the changes from the first run have been committed to the database and Process 1 is updating the found BOs with the values already there (not really changing the values at all) so Process 4 is finding the expected values that were already there when the Main Process was run a second time.
From an earlier post.
From this I gather that Process 1 does a FIND and updates the records found. Since the BOs found in Process 1 are not in CONTEXT when Process 4 executes, you must be doing a FIND again and you are expecting to find the updated values.Ewanm wrote:As far as I know, thats what I have but Process 4 does not return the expected values, it returns the values based on the output from Process 1 before Process 1 executed.
Process 1 simply finds records based on the find query then sets then sets the required attribute in the found records. Process 4 uses this attribute in its find query. Process 4 appears to use the original values before Process 1 executed.
This is not true because changes to the database do not get committed until all processes complete, so Process 4 is finding the original values.
The reason executing the Main Process again works might be because the changes from the first run have been committed to the database and Process 1 is updating the found BOs with the values already there (not really changing the values at all) so Process 4 is finding the expected values that were already there when the Main Process was run a second time.
Bob
Re: Process Execution
Thanks, that sounds exactly like what I am seeing, can you suggest a method of making sure the Process 1 updates are committed before Process 4 is executed?
Sounds like you are on the correct track. Thanks
Sounds like you are on the correct track. Thanks
-
- Posts: 1457
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: Process Execution
As the commit doesn’t happen until the end of the process you would want to kick off the process that requires the updated version of BO1 in series with the process that makes the original updates
So
P1>P2>P3>P4
Which when you look at the log will look like
P1 do stuff call P2
P2 do stuff call P3
P3 do stuff call P4
P4 do stuff end
As opposed to Process A
Call P1
Call P2
Call P3
Call P4
So
P1>P2>P3>P4
Which when you look at the log will look like
P1 do stuff call P2
P2 do stuff call P3
P3 do stuff call P4
P4 do stuff end
As opposed to Process A
Call P1
Call P2
Call P3
Call P4
Re: Process Execution
PointsWell option is 1 way to do it.
There are at least 2 other options:
1) Remove your FINDs from Process 1 and 4 and add it in your Main process and add your BO to the Process Input of the processes that update or use it.
2) Keep your FIND where it is, in Process 1 and on your FIND add IN BATCHES OF 1 That would force Aware to commit the changes after each record found is updated.
There are at least 2 other options:
1) Remove your FINDs from Process 1 and 4 and add it in your Main process and add your BO to the Process Input of the processes that update or use it.
2) Keep your FIND where it is, in Process 1 and on your FIND add IN BATCHES OF 1 That would force Aware to commit the changes after each record found is updated.
Bob