Mind Bender: Updates of Other BOs after long process runs

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Mind Bender: Updates of Other BOs after long process runs

Post by tford »

crm_view - BO for an an Existing External table

Invoice - BO an Aware table

"Scrape" Process needs to run periodically to read crm_view instances after a specified date, then create Invoice instances IF one does not exist already.

After that process is done, all instances of two other BOs need to be updated.

All works fine when I run "Scrape" from a menu, then run the two "Update" processes via a menu.

My challenge is how to get the Updates to automatically execute once after the "Scrape" is complete.

----
Process: Scrape_Invoices_From_View_1
Rule 1 - FIND crm_view WHERE crm_view.invoice_date>=SystemSettings.Invoice_Scrape_Beg_Date AND crm_view.invoice_date<=SystemSettings.Invoice_Scrape_End_Date IN BATCHES OF 1
Rule 2 - If COUNT Invoice WHERE (Invoice.Job_Number=crm_view.job_number)=0 Then
Scrape_Invoices_From_View_2

Process: Scrape_Invoices_From_View_2 (Input: crm_view)
Rule 1 - FIND ... [this is all good .. FINDs a bunch of related BOs that need to be referenced in the CREATE]
Rule 2 - CREATE Invoice WITH ...... [this is all good]

-----

My challenge is how to insert the FIND ALL Sales_by_BDL // UPDATE Sales_by_BDL into ... Process: Scrape_Invoices_From_View_1 ... so it only executes once at the end of processing all crm_view records.


Any clues?
Tom - V8.8 build 3137 - MySql / PostGres
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Mind Bender: Updates of Other BOs after long process run

Post by Jaymer »

create another level ABOVE everything.

top level:
call scrape-invoices (which calls level 2)
now after all that, the final process to run once
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
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Mind Bender: Updates of Other BOs after long process run

Post by PointsWell »

tford wrote:My challenge is how to insert the FIND ALL Sales_by_BDL // UPDATE Sales_by_BDL into ... Process: Scrape_Invoices_From_View_1 ... so it only executes once at the end of processing all crm_view records.

Any clues?
Use a control BO to record when the scrape has occurred. Give it a status or a step number field.

Scrape process starts creates a control BO with step 1.
Business rules on control BO when step 1 run process to collect CRM data. When this process ends it sets the step field to step 2
Business rule when step is changed and step =2 then do the invoice step, last step in that process sets step to 3
Business rule when step is changed to 3 then do the supplementary steps.

If you add a GET_CHANGES business rule on your Control BO you also have a self generated log of the process running with time of change and the step being run, you could get more involved and have the process report the number of invoices created and their numbers.
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Mind Bender: Updates of Other BOs after long process run

Post by tford »

YES! -- Jaymer, you're my hero of the day! Can't believe I've never done what you suggested before. Simple & effective.

PointsWell --- You're the honorable mention of the day, for sure! I'm going to incorporate your concept into some of my processes once I get a bit further along with my app.

I really appreciate the help!
Tom - V8.8 build 3137 - MySql / PostGres
Post Reply