Decision table final logic
Decision Table Final Logic
Once a Decision Table is designed, it will build up all the expressions for actions and conditions based on how it is modeled.
All Decision Tables will be translated (compiled to) Validation logic on execution. To check the executable validation tree logic, click on the Compile to Validation Tree highlighted on the above toolbar.
You can see the actual expressions that will be evaluated. Let's say you have modelled the following Decision Table:
Once you press the button, you can see the XML representing the tree logic of your Decision Table will all build expressions. For example, the picture below shows you the R7 rule:
It is also possible to retrieve the Validation Tree programatically. To do that you need to:
- Get ITable of your Decision Table
- Use TableParser parse and transform your Decision Table to its validation tree
// Load the Decision Table model from its content (i.e., binary/string) var decisionTableModel = LoadAdapterUtility.LoadModel(Encoding.UTF8.GetBytes(decisionTable)); // Create a table reader to build ITable of the Decision Table model var reader = new XmlTableReader(decisionTableModel); IIterable<ITable> tables = reader.GetTables(); // Use TableParser to create the validation tree of the Decision Table IElementModel validationModel = TableParser.CreateParser().Parse(tables).First(); // If you need the XML equivalent of any IElementModel, you can use ToXml method. string validationXml = validationModel.ToXml();