1

I have right now two types of rules one is input validation rule and the other one is business rules. How do I distinguish rules while creating through the editor. I am saving all the rules in the database. While evaluating the rules I fetched all the rules from the database and want to execute first the validation rules. If all passed then execute business rules otherwise return all the error output message. Please advise.

1 Answers1

0

There is no separation between the logic built into your rules. It's up to your code on how to distinguish types of your rules. If the source of rules is the same, the editor cannot really tell you rules apart. Try to use your UI to allow rule authors to indicate which type of rule they are currently creating. You could also have separate source objects for validation and business logic. By knowing the source type you'll be able to see whether the rule is of a validation or a business type.

Alex
  • 566
  • 1
  • 6
  • 14
  • So how would I know the source type for separate source objects of validation and business through the rule XML? – Muhammad Adnan Khan Aug 12 '20 at 19:05
  • 1
    The node has Type attribute. You can read its value to see if the source object for this rule is of validation logic. Or just add some control (such as dropdown) to the UI and let your users chose which rule type they want to use for the current rule. – Alex Aug 13 '20 at 22:31