Applicable to multiple items how do I know the end of proces

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

Applicable to multiple items how do I know the end of proces

Post by swiftinitpvtltd »

When running process with Applicable to multiple items how do I know the end of process meaning if there are 20 items checked in grid how do I know when 20 items are processed via my process and now I need to run one last process at the end(not 20 times).
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Applicable to multiple items how do I know the end of pr

Post by PointsWell »

Not clear from the question how you are running the processes and what is happening to these selected items but...

If the activities in the selected objects are unique then you need to pass them into a sub Process one at a time. When you are finished with these then the next process will run

Code: Select all

PICK ONE OR MORE from QUERY
SubProcessForEachBOFound
Next step
SubProcess will receive whatever BO user has selected and repeats one at a time until last one before moving on to NextStep.

You won’t know how many have been selected but it will process all before next step.
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

Re: Applicable to multiple items how do I know the end of pr

Post by swiftinitpvtltd »

Thanks PointsWell. Pick suggestion is good. Also I figured few things from process behavior. When you have a loop and Take Best 1 in FIND the behavior of process steps changes slightly. When you put second rule it becomes an end of the process when Applicable to multiple items is applied while calling it. In first rule step you call subprocess(20 times it will do) and in second rule you call the "good bye" meaning end process which only runs once irrespective of how many items are checked in grid(Applicable to multiple items). These processes have a peculiar pattern for each type of complex behavior and you will have to experiment to get the feel of it :) . Similarly in userguide its mentioned that there is no fix order in which all these rules in process run. I have not seen it behaving in different order each time multiple rules run in a single process but still...
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Applicable to multiple items how do I know the end of pr

Post by PointsWell »

swiftinitpvtltd wrote:Similarly in userguide its mentioned that there is no fix order in which all these rules in process run. I have not seen it behaving in different order each time multiple rules run in a single process but still...
There is no fixed order in which business rules run. Processes run in the order that they are written.
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

Re: Applicable to multiple items how do I know the end of pr

Post by swiftinitpvtltd »

Thanks.
I am trying to understand below from rules guide-
Overview of the Rule Engine Framework
Most rule collections in Aware IM are un-ordered, such as rule collections attached to
business objects and notifications as well as processes that have the “Maintain rule
order” flag turned off.
From the name of the rule collection it is clear that the order of
rules in the collection does not matter. So how does the rule engine in Aware IM decide
which rules to evaluate first, second and so on?
if we have a process and process has 20 steps(rules) in it are those getting executed 1 to 20?(from top to bottom)
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Applicable to multiple items how do I know the end of pr

Post by PointsWell »

swiftinitpvtltd wrote:Thanks.
I am trying to understand below from rules guide-
Overview of the Rule Engine Framework
Most rule collections in Aware IM are un-ordered, such as rule collections attached to
business objects and notifications as well as processes that have the “Maintain rule
order” flag turned off.
From the name of the rule collection it is clear that the order of
rules in the collection does not matter. So how does the rule engine in Aware IM decide
which rules to evaluate first, second and so on?
if we have a process and process has 20 steps(rules) in it are those getting executed 1 to 20?(from top to bottom)
Rules are a series of operations and functions that are applied to Business Objects and entered on the Update Rules and Deletion Rules tabs of the Business Object. There is no set order that they execute in.

Processes always execute in the order that they are written. Process steps are not Rules (capital R). It would be impossible to write code that you had no expectation of the order that it is executed.

If you have a Business Object in context and then call a sub process (that uses the BO as an input) then that BO will drop to the sub Process. If you have 20 BOs in context and then call a sub Process then that sub Process is called 20 times, once for each instance of the BO.

Therefore if you have a process to FIND all your Contacts where they live in the USA and then want to do one thing if they are in NY and another if they are in CA and then once you've finished set them all to processed it would look like this:

Code: Select all

FIND Contact WHERE Contact.Country='USA'
ProcessStates
Contact.Compeleted=Yes
Where ProcessStates has INPUT Contact and does this:

Code: Select all

If Contact.State='NY' THEN DoSomething ELSE
IF Contact.State='CA' THEN DoADifferentThing
This will FIND all the Contacts in USA then go through the list of the Contacts that it has found and pass them one at a time into the ProcessStates sub Process. Once it has completed the ProcessStates for every Contact it has found it will set Contact.Completed to Yes for all of the Contacts at once.

It will execute in this order always.

** This is an example and not the most efficient way, you would probably want to have an IF statement on the ProcessStates to make sure you didn't needlessly run the ProcessStates for Contacts in the other 48 states.
swiftinitpvtltd
Posts: 370
Joined: Sat Apr 28, 2018 3:33 am
Location: India
Contact:

Re: Applicable to multiple items how do I know the end of pr

Post by swiftinitpvtltd »

Great explanation! Thanks.
It will execute in this order always.- So I can safely use processes(not rules) to add multiple steps and it will execute from 1 to 20...
PointsWell
Posts: 1457
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: Applicable to multiple items how do I know the end of pr

Post by PointsWell »

swiftinitpvtltd wrote:Great explanation! Thanks.
It will execute in this order always.- So I can safely use processes(not rules) to add multiple steps and it will execute from 1 to 20...
Yes
BobK
Posts: 544
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: Applicable to multiple items how do I know the end of pr

Post by BobK »

swiftinitpvtltd wrote:Most rule collections in Aware IM are un-ordered, such as rule collections attached to
business objects and notifications as well as processes that have the “Maintain rule
order” flag turned off.
This documentation is probably obsolete.

In old versions of AwareIM, on the General tab of a Process definition, there was a "Maintain rule order" option. This option was turned on by default. I never un-checked it (turned it off), but I assume doing so would allow AwareIM to run the Process rules in any order.

I do not see this option in the newest version of AwareIM
Bob
ACDC
Posts: 1138
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Re: Applicable to multiple items how do I know the end of pr

Post by ACDC »

I am trying to understand below from rules guide-
Overview of the Rule Engine Framework
Deep down in the heart of the AwareIm system is a Rete Based rules engine, not much is said about this dynamic feature other than a brief mention of it somewhere in the technical specs. In my mind its the secret source and one of the main building blocks and success of the AwareIM system, not to mention numerous other features a well

If you read up about the Rete Algorithm it might give you a better insight as to what's happening under the hood when it comes to the behaviour of the AwareiM rules engine

https://en.wikipedia.org/wiki/Rete_algorithm
Post Reply