This content has been marked as final. Show 2 replies
Disclaimer: I don't work for Oracle, and the expert staff at Oracle may have better methods of solving this problem.
In general, it is my understanding that values are copied via "InstanceValueIf" function when you want a comparison.
Assuming that the benefit and the person are related to global...
Assuming that the relationships are the default relationships created (e.i. all instances of the person, and all instances of the person's living places for the person).
Assuming that we have the following variables:
the person's living places id, which we want to match to the benefit's living place id
the person's living places type, which we want to copy into the benefit copied type
I understand that a challenge is trying to traverse more than one relationship.
However, the logic could be performed as follows:
the benefit copied type =InstanceValueIf(all instances of the person, InstanceValueIf(all instances of the person's living places for the person, the person's living places type, the person's living places id = the benefit's living place id), Exists(all instances of the person's living places for the person, the person's living places id = the benefit's living place id))
There may be a simpler solution, but part of the problem is created by lack of relationships.
I have to add a few more disclaimers:
I would caution that this rule is very developer centric and will be very hard for BAs to read. I would not normally write (or even need) this type of rule when writing rules from policy documents.
Given the developer centric rule, it would be good to have a relationship between B and C (even inferred). This relationship can simplify the rules and readability. Lack of relationships can cause unexpected results applying the above rule when the identifying values are unknown/uncertain or when multiple entities have the same identifying values. Two people might have the same living place or a living place might not have an id. You may have to create a rule table to start handling exceptions when things are unknown, or when there are duplicates, and other situations that are a result of not checking referential integrity.
when you want to write a rule to set a value on an instance derived from a value on another instance, you must be able to determine which instance you are talking about. In your example, to set a value on instance "C" (the benefit) based on instances 'A' the person and 'B' the person's living spaces, you need to be able to relate the person to the benefit.
If there is one benefit (C) in a session and one person (A) then you can write simple rules because there is one person, so the relationship is obvious (there is only one person entity allowed, so this must the person)
The below rule works because the relationship "all instances of the person" is a one-to-one relationship from the global, so I can write the rule knowing there can only be one person.
The value of the benefit = For(all instances of the person, the person's value)
If I allow more than one person. then I have to be able to uniquely identify the person to get the value from. I can do this using the InstanceValueIf rule
The condition in the above statement must uniquely indentify the person so the value can be returned.
The benefit’s value = InstanceValueIf(all instances of the person, the person’s value, condition)
Hope this helps