passing parameters to processes triggered by rules

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ColinP
Posts: 30
Joined: Thu Jul 09, 2020 7:57 am
Location: London UK

passing parameters to processes triggered by rules

Post by ColinP »

To each Project potential Suppliers can be Allocated, perhaps three from the whole list.
Each project is split between a number of Elements.
When the user looks at each element she wants to see all the potential suppliers and for that element, she may deactivate them or enter costing information.
This is easy enough.
The problem arises when addition potential suppliers are aded to the list. These need adding to each element. Or when additional elements are added to the Project.
So before viewing the Element I must re-evaluate the list of Suppilers to add any added to the potential Suppliers. (I do not delete any removed)
Stage 1 I use a process to view the form, but before doing so I bring all the allocated Suppliers into Context and then UPDATE Suppliers
Stage 2 I have a rule for Suppliers which calls a process with the parameter of Supplier
Stage 3 This process, If the costing line does not exixt, creates it it and set its relationships.
The rule does this for each instance of Supplier in Context.
Brilliant - Easy and it works fine.
But I have been forced into the most ugly bit of coding that I am embarrased to mention in polite company, in order to get the Project Instance into the Stage 3 process CONTEXT, I have had to save it in a Business Object Attribute.
If I call Stage 3 process USING Supplier, Project the testlog tells me that when the rule is triggered it does not have access to the Project instance.
Obviously this is in CONTEXT in Stage 1, but I lose it at Stage 2.
I would love to get rid of the ugliness in my coding. Any Ideas?
Colin
------------------------------------------------------------------------------------------------------------------------
AwareIM 8.7 (Build3012) Windows Virtual Server Derby
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: passing parameters to processes triggered by rules

Post by tford »

I don't have a clear picture of whether Stage 1, Stage 2, and Stage 3 are processes or what they are.

It would be helpful if you outlined your processes with:
1- Process name
2- Process input
3- Indication about what processes call other processes.

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

Re: passing parameters to processes triggered by rules

Post by Jaymer »

And pics never hurt.
I read thru this - tried to understand - and gave up
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
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: passing parameters to processes triggered by rules

Post by tford »

^^ me too.

It's most helpful when talking asking for help with process or rules if you post the exact process or rules you are using rather than just describing them.

As a friend of mine says "it's like trying to send a haircut in the mail"
Tom - V8.8 build 3137 - MySql / PostGres
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: passing parameters to processes triggered by rules

Post by PointsWell »

If you have a series of steps

Step 1 calls Step 2
Step 2 calls Step 3

and want to use Project from Step 1 in Step 3 then you need to keep this in context through all of the steps, so even if you are not using Project in Stage 2 you still need to pass it to Stage 2 make it available in Stage 3

The other thing to consider is that if

Supplier is owned by Element is owned by Project

If you have Supplier in context then you can derive Project as

Supplier.obElement.obProject (as long as your chain from Supplier to Project is solitary and not multiple, I.e. one supplier has one Element has one Project)

If you must use the Project element (and can't use the reference chain) but can't keep it in context for Step 2 you could place
Find Project Where Project=Supplier.obElement.obProject
Into your Step 3

Jaymer has done some work to confirm that a BO being in context does not equate to it not being searched for against the database, so when each process is called the SQL in the background is run to find the items in context, so the additional find isn't a major efficiency cost.
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: passing parameters to processes triggered by rules

Post by Jaymer »

Now I understand what he’s trying to do.

And as Sean pointed out, values aren’t passed in memory when you think they’re in context. Aware is doing a physical read to load records in the context. So whether it reads it or you do a find, it’s pretty much all the same (just so you realize physical IO is happening, plus all of the linked/related records and shortcut look up’s are being resolved).
The analysis thread he’s referring to is here.
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
Post Reply