Hi,
This is a rule attatched to an object called 'Object':)
1st case :
If
Object IS NEW
Then
FIND Object WHERE Object.NumberAttribute<300 AND Object.ID<>ThisObject.ID
REDUCE Object.NumberAttribute BY ThisObject.NumberAttribute
Important : ThisObject can't be find by the FIND action.
In this case, the REDUCE action occurs on all Object in the context, that is to say ThisObject and all object find by the FIND action.
2nd case:
If
Object IS NEW
Then
FIND Object WHERE Object.NumberAttribute<300 AND Object.ID<>ThisObject.ID
REDUCE ThatObject.NumberAttribute BY ThisObject.NumberAttribute
In this case, the REDUCE action only occurs on the first Object find by the FIND action (Object with the lowest ID I think). In fact, That prefixe referes to the second object in the context.
So, my question is, when the first object in the context has the same type as a list inserted in the context just after, is there an elegant way to apply an action on this list only?
Warm regards,
Christophe
Second object in the context is a list
Christophe,
Here is one way to solve it:
1- Create another non persisted BO called NewInfo with 2 attributes:
a- NewID - number
b- NewNumber - number
2- Create 3 processes:
a- ProcessNewObject2
--- 2 inputs for this process: NewInfo & Object
--- 1 rule: REDUCE Object.NumberAttribute BY NewInfo.NewNumber
b- ProcessNewObject
--- 1 input for this process: NewInfo
--- 2 rules as follows:
FIND Object WHERE Object.NumberAttribute<300 AND Object.ID<>NewInfo.NewID
ProcessNewObject2
c- EnterNewObject
--- No Inputs
--- 3 rules as follows:
ENTER NEW Object USING Main
CREATE NewInfo WITH NewInfo.NewID=Object.ID,NewInfo.NewNumber=Object.NumberAttribute
ProcessNewObject
To create new objects, you will run the process called EnterNewObject.
You will remove the rules in the Object BO & just let these 3 processes to all the work.
Tom
Here is one way to solve it:
1- Create another non persisted BO called NewInfo with 2 attributes:
a- NewID - number
b- NewNumber - number
2- Create 3 processes:
a- ProcessNewObject2
--- 2 inputs for this process: NewInfo & Object
--- 1 rule: REDUCE Object.NumberAttribute BY NewInfo.NewNumber
b- ProcessNewObject
--- 1 input for this process: NewInfo
--- 2 rules as follows:
FIND Object WHERE Object.NumberAttribute<300 AND Object.ID<>NewInfo.NewID
ProcessNewObject2
c- EnterNewObject
--- No Inputs
--- 3 rules as follows:
ENTER NEW Object USING Main
CREATE NewInfo WITH NewInfo.NewID=Object.ID,NewInfo.NewNumber=Object.NumberAttribute
ProcessNewObject
To create new objects, you will run the process called EnterNewObject.
You will remove the rules in the Object BO & just let these 3 processes to all the work.
Tom