Hi,
I have two reference attributes on my object (one called Services_Add and one called Services_Del). I have a rule that assures that you can not have a reference to the same service in both attributes like so:
If Services was added to Staff.Services_Add and AddedServices in Staff.Services_Del then
report error 'Cannot have same service in both Services_Del and Services_Add'
else if Services was added to Staff.Services_Del and AddedServices in Staff.Services_Add then
report error 'Cannot have same service in both Services_Del and Services_Add'
This works ok, but I get these errors in the log:
Value of Services could not be resolved
Unable to resolve facts fro the following pattern IN expression for object Staff.Services_Add null
I think what is happening is that this rule is being run when nothing is added to Services_Add or Services_Del which means that AddedServices is null which is throwing the error in the log.
This seems to work ok even with the error, but is there a way to write the rule so I do not get the errors. What I was hoping for is that the engine will stop checking a rule once one of the facts is false (e.g. shortcut), but it seems to check all facts even though the first fact 'Services was added to Staff.Services_Add' is false (e.g. I change some other attribute on the object and I see the errors).
thanks for your help.
ski
Errors (Warnings) on resolving values
-
- Posts: 58
- Joined: Mon Nov 13, 2006 9:15 pm
- Location: Bothell, USA
-
- Posts: 595
- Joined: Sun Apr 24, 2005 2:22 am
- Contact:
-
- Posts: 58
- Joined: Mon Nov 13, 2006 9:15 pm
- Location: Bothell, USA
-
- Posts: 58
- Joined: Mon Nov 13, 2006 9:15 pm
- Location: Bothell, USA
Thanks Tom, This worked for the rule that reports the errors as I rewrote it to be:
If EXISTS Services where (Services in Staff.Services_Add and Services in Staff.Services_Del) then
report error 'Cannot have same service in both Services_Del and Services_Add'
Now I have a problem with the rule for adding/deleting "normal" entries into the Staff.Services attribute. Background is that I have 4 attributes that are associated with each other (Services, Services_Auto, Services_Del, and Services_Add). Services is calculated from the other three. Services_Auto is calculated from imports from other systems. Services_Add is used to add an additional attribute while Services_Del is used to remove an imported attribute. The rule for Services_Add is:
If Services was added to Staff.Services_Add
then insert AddedServices in Staff.Services
else if Services was removed from Staff.Services_Add
then remove RemovedServices from Staff.Services
Services_Del is the same. The problem is Services_Auto as it not only has to handle adds and deletes but it has to check to assure that it respects the overrides in Services_Add or Services_Del. I have tried:
If Services was added to Staff.Services_Auto and not (exists AddedServices where (AddedServices in Staff.Services_Del))
then insert AddedServices in Staff.Services
else if Services was removed from Staff.Services_Add and not (exists RemovedServices where (RemovedServices in Staff.Services_Add))
then remove RemovedServices from Staff.Services
and a process that tried to delete all Services in Services and then added back in the ones in Services_Auto and Services_Add and then deleted the ones in Services_Del
No luck.
Any ideas?
If EXISTS Services where (Services in Staff.Services_Add and Services in Staff.Services_Del) then
report error 'Cannot have same service in both Services_Del and Services_Add'
Now I have a problem with the rule for adding/deleting "normal" entries into the Staff.Services attribute. Background is that I have 4 attributes that are associated with each other (Services, Services_Auto, Services_Del, and Services_Add). Services is calculated from the other three. Services_Auto is calculated from imports from other systems. Services_Add is used to add an additional attribute while Services_Del is used to remove an imported attribute. The rule for Services_Add is:
If Services was added to Staff.Services_Add
then insert AddedServices in Staff.Services
else if Services was removed from Staff.Services_Add
then remove RemovedServices from Staff.Services
Services_Del is the same. The problem is Services_Auto as it not only has to handle adds and deletes but it has to check to assure that it respects the overrides in Services_Add or Services_Del. I have tried:
If Services was added to Staff.Services_Auto and not (exists AddedServices where (AddedServices in Staff.Services_Del))
then insert AddedServices in Staff.Services
else if Services was removed from Staff.Services_Add and not (exists RemovedServices where (RemovedServices in Staff.Services_Add))
then remove RemovedServices from Staff.Services
and a process that tried to delete all Services in Services and then added back in the ones in Services_Auto and Services_Add and then deleted the ones in Services_Del
No luck.
Any ideas?
-
- Posts: 58
- Joined: Mon Nov 13, 2006 9:15 pm
- Location: Bothell, USA
bummer, just figured out that the rule for Services_Add will not work as I have the case like so:
State1: Service1 defined in Services_Auto and Service2 in Services_Add
State2. Service2 added to Services_Auto
State3. Service2 removed from Services_Add
State3 breaks as the rule removes Service2 from Services when it should not.
Ugh!
State1: Service1 defined in Services_Auto and Service2 in Services_Add
State2. Service2 added to Services_Auto
State3. Service2 removed from Services_Add
State3 breaks as the rule removes Service2 from Services when it should not.
Ugh!
-
- Posts: 58
- Joined: Mon Nov 13, 2006 9:15 pm
- Location: Bothell, USA
Ok, I got this to work, but only by going back to the original rule set that triggers warnings like:
Value of Services could not be resolved
Unable to resolve facts for the following pattern IN expression for object staff.Services_Auto null
I think the error is coming from rules that look like this:
If Services was added to Staff.Services_Del and RemovedServices in Staff.Services_Auto
then remove AddedServices from Staff.Services
Where it tries to evaluate and RemovedServices... even though it hasn't evaluated the first part of the rule yet.
Everything seems to work perfectly, I just get the annoying warnings in the logs. Any ideas on a better way to solve this problem are appreciated.
cheers,
ski
Value of Services could not be resolved
Unable to resolve facts for the following pattern IN expression for object staff.Services_Auto null
I think the error is coming from rules that look like this:
If Services was added to Staff.Services_Del and RemovedServices in Staff.Services_Auto
then remove AddedServices from Staff.Services
Where it tries to evaluate and RemovedServices... even though it hasn't evaluated the first part of the rule yet.
Everything seems to work perfectly, I just get the annoying warnings in the logs. Any ideas on a better way to solve this problem are appreciated.
cheers,
ski