Decisions

  • 24 December 2020
  • 0 replies
  • 11 views

Userlevel 1
Badge +2

A decision is a programmatic construct in USoft Definer that allows you to:

  • Mix logic expressed in SQL with logic expressed in action scripts.
  • Add branching and looping to SQL statements and action scripts.

This is a technical concept. Do not confuse it with the business concept of 'decision' as used in Decision Engines and Decision Modeling and Notation (DMN, the OMG standard first published in 2014). The USoft Rules Engine can functionally act as a Decision Engine, but it is not technically defined in terms of decision trees or decision calls. Instead, it automatically implements business rules in response to data manipulation events. As such, it is constructed entirely by implementing Business Rules and does not need Decision as a modeling concept.

A Decision is defined in the Decisions info window, which displays the 4 attributes that make up every decision:

  • Decision Name.
  • Decision SQL.
  • Yes Action.
  • No Action.

Example

The decision shown in the picture below uses SQL to retrieve the name of the system directory and concatenate it with a command-line instruction. The result is passed to the operating system (and represented by the :1 placeholder in the Yes Action) for execution.

If, for some reason, the SQL statement does not yield a result, nothing happens (No Action). This is probably not expected in this particular situation.

The decision is executed when it is called from an Action Task in a job, from another (or indeed from the same) Decision, from a GUI element in Windows Designer or Web Designer, or from an action script in a SQL Command window. The call from an Action Task looks like this:

ActionDecision( TEST_SYSTEM_CREATE_APPDATA )

To call a decision from a SQL context, for example the SQL Command window, you must use the action keyword :

action ActionDecision( TEST_SYSTEM_CREATE_APPDATA )

Defining and checking a decision

To define a decision:

1. Choose Define, Decisions from the USoft Definer menu. The Decisions window is opened.

2. Fill out the Decision Name , Decision SQL , Yes Action , and (if used) No Action .

3. Press the Check button. This will check that the Decision SQL syntax is correct.

  • If the syntax is correct, the Correct flag is set.
  • If the syntax is not correct, you get an error message.

4. Save work.

Calling a decision

To call the decision you have defined, use the ActionDecision() action as outlined earlier in this help topic. For details, see the ActionDecision() help topic in the Developer Reference Guide. You can reach this topic by searching for the action name in the index of the USoft Definer Help.


This topic has been closed for comments