Rule engine - value of attribute could not be resolved

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
nhofkes
Posts: 94
Joined: Mon Sep 07, 2020 6:03 am
Location: Netherlands

Rule engine - value of attribute could not be resolved

Post by nhofkes »

In a Transaction BO I have rules to update the transaction balance based on the values of the line items owned by that transaction:

Code: Select all

If TransactionLineItem WAS ADDED TO Transaction.om_LineItems Then
INCREASE Transaction.TotalNumber BY AddedTransactionLineItem.Number
INCREASE Transaction.TotalPrice BY AddedTransactionLineItem.Price
(I have similar rules for item WAS REMOVED and item WAS CHANGED).

It works fine, but in the rule log I get several information messages stating that the value of attributes could not be resolved:
Screenshot 2022-10-13 095652.jpg
Screenshot 2022-10-13 095652.jpg (67.57 KiB) Viewed 1332 times
I did some tests and it seems to me that the messages may be caused by the rule engine trying to evaluate the value of the attributes in the action even before the conditions for that action have been finally calculated. Presumably, if that attribute value is null, it results in the message that the value cannot be resolved. In a traditional programming language, the code after the THEN statement would not be executed if the condition after IF is evaluated to FALSE. But in Aware, I think that it may work differently - otherwise I can't explain the log messages, because the attributes that the messages refer to are only used in the action after THEN and not in the IF conditions, and all conditions are being evaluated to False so there isn't any reason to evaluate the statements in the THEN clause.

Is there anyone who could confirm this, or otherwise share some insights? It would be good to know if I can savely ignore these statements in the log.
Niels
(V9.0 build 3241 - MariaDB - Windows)
hpl123
Posts: 2579
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Rule engine - value of attribute could not be resolved

Post by hpl123 »

I also see his in logs and usually ignore it. I think you are correct in your analysis and these entries are due to evaluations being made before data is actually populated in the attribute. The rule engine does a lot of evaluations and each rule is evaluated many times at different times so is a bit difficult to understand exactly when and why things happens. Try playing around with the settings defining if the rule is an initialization rule or not (and possibly also priorities i.e set a lower/higher priority for rules), that may change this behavior (but make sure you do still get the results you intended i.e data is actually populated etc.).
Henrik (V8 Developer Ed. - Windows)
Post Reply