Expressions

From Keyfax Wiki
Revision as of 14:14, 31 January 2018 by Wikiadmin (talk | contribs) (Created page with "Home > Databoxes > Using a Databox - Expressions Using a Databox - Expressions When using Databoxes within a Script you may wish to manipulate the data in the Databox, combi...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Home > Databoxes > Using a Databox - Expressions

Using a Databox - Expressions

When using Databoxes within a Script you may wish to manipulate the data in the Databox, combine it with data from another Databox, or perform a Conditional Assessment on the data to decide which path in the Script to take.

Each of these actions is performed by defining an Expression against the relevant Databox that will manipulate the data within it.


Tip

A full list of Expressions used in Keyfax Inter•View can be found in here.

An Expression can be written as either a Transformation or a Logical Assessment.

Transformation Expressions

Transformation Expressions re-format the data within the Databox. These are usually used when the core data stored in the Databox needs to be pulled out in a different format or when the data needs to be mathematically manipulated.

Examples of a Transformation are: •Reading the value of text in a Databox and putting it in UPPERCASE. •Multiplying the data in a Databox. •Reading only the first 3 characters of the data held in a Databox. •Reading the contents of a Databox and then adding it to the value held in another Databox.

Logical Assessment Expressions

A Logical Assessment (Conditional) Expression assesses the data within a Databox. The Expression used in a Logical Assessment should return a True or False value. The outcome of the Expression is used to control which path in the Scripts is taken.

Examples of a Logical Assessment are: •Taking a particular path in a Script if a Databox value is greater than 10. If it is not greater than 10 then a different path is taken, as shown above. •Changing the Script Set to be used if the user is set-up in a particular business group- this would be based on the information based in the import XML •Taking a particular path in a Script if the date is between the beginning of April and the end of November, for example winter months may increase the priority of some repairs.

Defining an Expression

Expressions are defined by editing the properties of the relevant Databox.

Click on the button to add a new Expression.

This presents a new Expression line that needs to be defined:

Title – The Title for the Expression. The 'Tab' key can be used to navigate between cells.

Value – The Expression to be applied to the data in the Databox. The 'Tab' key can be used to navigate between cells.

Cond? – This check box specifies whether the Expression is to be a Logical Assessment (Conditional) or a Transformation. If the check box is ticked, the expression is a Logical Assessment (Conditional) Expression. If it is un-ticked, the expression is a Transformation Expression. The box toggles directly between a checked and unchecked state, after it is initially set.


Tip

The Cond? check box needs to be set up in order to save an Expression. It cannot be left as its default setting. The Cond? check box can NOT be changed if the expression is still referenced by existing Scripts.

To remove an Expression from the Databox, selected the Expression and click on the button once.


Tip

The removal of an Expression can only be undertaken if it is not referenced in any existing Scripts. You must also be logged in to the administration console as Exclusive Login.

Creating a Basic Transformation Expression

The creation of an Expression uses a series of Functions and Operators that are similar (but not exactly the same) to those used in spreadsheet applications to manipulate data.

Examples of where Operators may be used on a value of X are:

X * 8

X /10
(X * 5) / 6
X + 7 

In addition functions may be used to convert and manipulate the data. The following example converts the text held in the Databox X to UPPERCASE:

Upper(X)


Tip

A full list of Expressions and Functions used in Keyfax Inter•View, with examples, can be found in Section 7.

When creating an Expression against a Databox, the value held in the Databox is automatically used as the first part of the expression and does not need to be identified.

For example to create a Transformation Expression that will convert the value of the Databox to UPPERCASE would be written as follows:

When dealing with Numerical Operators such as * / +, the contents of the Databox will need to be converted to a Number using the function Number().

This would be used (in context) as follows:


Tip

Any Databoxes used in a numerical calculation will need to be converted into a Number in order for the expression to function correctly.

Creating a Basic Logical Assessment Expression

When creating a Logical Assessment (Conditional) Expression, you must ensure that the ‘Value’ field contains an Expression that will return a TRUE or FALSE value.

Examples of such Expressions are: Number() > 10

Number() = 5
= ‘Hello’

= {Script.Details}

When creating the relevant expression, you must ensure that the ‘Cond?’ check box is ticked.