Ds
The ds function is used in a databox to recall the original value of that databox that was entered or populated. This is useful when you want to use the value of a databox multiple times in one expression.
These examples are available in the model scripts database provided when Keyfax is purchased.
Contents
Example One
The most simple example of this would be using it to square a number, multiply it by itself.
The script for this would look something like this.
The user is asked for a number to square, the expression Examples.ds.Square.value then makes the calculation and writes the result into the databox Script.Details which is then displayed in the message Example Message.DSSQR.
Setup
Script databox Examples.ds has an expression setup within as shown below.
Number * Number(ds)
This tells it to treat the value entered by the user as a number, then multiply it by the original value entered by the user.
For example, if you enter the number 9
Number 9 * Number(9) = 81
The result is written into Script.Details and output the message.
Example Two
A more complicated use would be to have an SQL query retrieve a value from a number of possible values from a database, then convert the retrieved value into something else.
This example uses a dynamic question to get a value from a database and write it to a databox, the expression in this databox then checks the value and outputs text to a message depending on the value. This has been used by a client to look up a numeric code from their Housing Database and convert this code into different phone numbers to call depending on the property location.