Decision Table

◷ Reading Time: 7 minutes

The Decision Table editor is a web component based on JavaScript and HTML DOM which allows you to simply integrate the authoring experience into your web application. You can apply your own style by overriding its CSS configuration.

Scenarios

Glossary

The editor supports a glossary and it loads business terms, values and expressions from the glossary.

Ordering Columns

The Decision Table editor allows users to reorder the columns simply by dragging the column header’s handle and dropping it into the new location.

Ordering rows

The Decision table editor allows users to reorder the rows simply by finding an empty space in a row, dragging it and then dropping it in the right location.

Video Description

API

The JavaScript API allows your application to build a Decision Table in JavaScript code and enables users to add rules in the Decision Table.

Example

Below is the example to create an empty Decision Table. The code creates a decision table with:

  • a condition named Age name and expression to fact.Age
  • an action named Eligible and expression to fact.CanEnroll
 var dt = newDecisionTable('Age Decision');
 dt.createColumnCondition({ name: 'Age', expression: 'fact.Age' });
 dt.createColumnAction({ name: 'Eligible', expression: 'fact.CanEnroll' });

Load or Create

DecisionTable editor will be added to the UI of your application. It can be:

  • Created from an existing Decision Table content, Or
  • an empty (new) Decision Table so the structure must be specified by columns methods

toDecisionTable

Creates the decision table editor from an HTML element

toDecisionTable ()

return: reference to decision table editor

loadDecisionTable

Load the decision table content in to the editor

loadDecisionTable (content)

content: string content of decision table in XML format

newDecisionTable

Creates a new (empty) decision table into the editor

newDecisionTable (name)

name (string): Name of the decision table

Generate Decision Table

Once the users’ editing is finilized, your application should generate the DecisionTable content based on entered rules.

getDecisionTable

Generates the XML representation of Decision Table

getDecisionTable ()

Properties

Manages the properties of decision table.

getTableType

Returns the type of Decision Table: Validation, Decision

getTableType ()

This setting is obsolete in 7+ of FlexRule Runtime

setTableType

Sets type of Decision Table: Validation or Decision (default is validation)

setTableType (type)

This setting is obsolete in 7+ of FlexRule Runtime

getProcessAll

Returns processAll attribute of decision table

getProcessAll ()

setProcessAll

Sets processAll attribute of decision table

setProcessAll  (processAll)
  • processAll (boolean): true to make the decision table in Multi Hit policy, otherwise false to specify Single Hit policy.

getName

Returns name attribute of decision table

getName ()

setName

Sets name attribute of decision table

setName (name)
  • name (string): Representing name of the Decision Table

Glossary

clearGlossaries

Creates the decision table editor from an HTML element

clearGlossaries ()

return: reference to the Decision Table editor

getGlossaries

Retrieve list of glossaries addresses (uri)

getGlossaries (uri)

loadGlossary

Loads a new glossary to the Decision Table

loadGlossary (uri)

glossary: content of the glossary document to import into the editor

Columns

Column defines Condition, Action and Name structure in a Decision Table. A column has below properties:

  • name: name of the column
  • expression: expression of the column
  • term: name of the term (only if expression is not specified.)

getColumns

Lists of columns on decision table

getColumns ()

updateColumns

Update the columns of the Decision Table

updateColumns (columns)
  • columns: an array has the that as the

createColumnCondition

Creates a new ‘Condition’ on the Decision Table

createColumnCondition (column)
  • column: the column of the decision table which can have nameexpression and term properties

createColumnAction

Creates a new ‘Action’ on the Decision Table

createColumnAction (column)
  • column: the column of the decision table which can have nameexpression and term properties

createColumnNotice

Creates a new action ‘Notice’ on the Decision Table

createColumnNotice (column)
  • column: the column of the decision table which can have nameexpression and term properties

deleteColumn

Deletes the current selected column

deleteColumn ()

deleteColumnByIndex

Deletes a column by index

deleteColumnByIndex (index)
  • index (int): Index value of a column to be deleted

Rows

addNewRow

Adds a new row to the Decision Table

addNewRow ()

deleteRow

Deletes the current row from the Decision Table

deleteRow ()

Parameters

signature on a web editor gives you the declaration section of a logic. This allows you to manage the value and types parameters of your logic in JavaScript.

var flow = flow.loadFlow(flowXml, flowHelper);
var signature = flow.signature;
// and now you have access to signature of the logic
// ...use properties and methods descried in API section...

API

Properties

// Returns input parameters
inputs
 
// Returns output parameters
outputs
 
// Returns input-output parameters
inputOutputs

Methods

// Adds input parameters
addInputs(names)
 
// Adds output parameters
addOutputs(names)
 
// Adds input-output parameters
addInputOutputs(names)
Updated on January 12, 2021

Was this article helpful?

Related Articles