I wrote a few months ago about an undocumented way to write complex business rules in Priority. Whilst I was copy editing my thesis again this morning, finding a few errors, I had a minor epiphany when reading the section about form triggers. I have always believed that it is not possible to write a business rule which compares two fields in the form (e.g. display an error message when the production date of a customer order is greater than the date that the customer wants to receive the order) and so have always handled such cases with a trigger.
This morning it occurred to me that it is possible to write a business rule which will compare two fields. In my previous blog, I showed an example which can be read as "Display an error message if the value in the 'towarhsname' field differs from the expression (:$.TOWARHSNAME IN ('23', '999') ? :$.TOWARHSNAME : '!!!'). Ignoring the technical aspects of this, I was using the same variable name in the expression as in the rule part. This doesn't have to be so! It would be very easy to write a rule which states "Display an error message if the value in the 'promised customer date' is less than", with the expression being the screen name for the field containing the production date (:$.TEC_DUEDATE).
From a meta-programming view, this is another case of being blinkered: originally I was concentrating on how to define a rule which checked two non-contiguous values of one field, that I never considered the possibility of defining a rule which compares two fields.
[SO: 4502; 5, 21, 43
MPP: 812; 1, 4, 6
ELL: 964; 0, 2, 7]
No comments:
Post a Comment