Format Variable to String Action

image\Action_Variable_Format.jpg

The Format Variable to String action allows you to specify a format with which to display a number in a variable.

Note:
In doing the conversion, Opus converts the number to a string. Therefore if you need to perform further mathematical functions on it you must keep an unformatted copy and update the formatted variable from that.

Setting up the Format Variable to String action:

  1. Add the Format Variable to String action to your trigger, as described in adding actions. The Format Variable to String tab will automatically appear when you add the action.

  2. Use the Variable option in the Source panel to select the variable from the current publication that contains the number you want to format. Click on the down arrow to the right of the Variable box to list all of the variables in the current publication. Alternative, click on the Create New Variable… button to open the New Variable dialog box in which you can create a new variable.

  3. Use the Variable option in the Target panel to select the variable from the current publication in which you want to store the formatted number. Click on the down arrow to the right of the Variable box to list all of the variables in the current publication. Alternative, click on the Create New Variable… button to open the New Variable dialog box in which you can create a new variable.

  4. Use the Show leading zeroes option if you want to display the variable with leading zeros. This will activated the Minimum Total Width option.

  5. Use the Minimum Total Width option if you want to set the minimum width of the number (including the decimal point). Use the spin buttons to set a specific number. By default this option is selected.

Note:
This does not specify the total number of zeroes that are added; simply the width the number should be as a minimum. For obvious reasons the actual number will always override this setting.

  1. Use the Precision box to set the number of decimal places that the width comprises of – this is referred to as the ‘precision’.

Note:
The precision is maintained irrespective of the actual number, so there is a rounding effect if necessary.

  1. Click on the Apply button to save your changes.

Note:
To always display two number on either side of the decimal point you need a minimum total width of five (two for whole numbers, one for the decimal point, two for the decimal precision. This will give you, for example:

09.05, 15.05, 09.25 and 15.25

If you increase the minimum total width to six without increasing the precision you will get:

009.05, 015.05, 009.25 and 015.25

If you increase the decimal places to three without increasing the minimum total width you will get:

 9.050, 15.050, 9.250 and 15.250

Related Topics:

Introducing the Variables Actions

Choosing an Action