Decimal Data Type

The Decimal data type allows numerical values with decimal points to be stored, such as 15.87 or 4.239756.

Conditionals

TODO (see common conditionals - what are those?)

Operations

Inc

The Inc operation will increment or add one to the value of the target Decimal.

<dcs.Var Name="TestVar1" Type="Decimal" SetTo="12.7" /> <dcs.With Target="$TestVar1"> <Inc /> </dcs.With> <dc.Out>TestVar1 is {$TestVar1}</dc.Out>

Output:

TestVar1 is 13.7

Dec

Inversely, the Dec operation will decrement or subtract one off the value of the target Decimal.

<dcs.Var Name="TestVar1" Type="Decimal" SetTo="12.7" /> <dcs.With Target="$TestVar1"> <Dec /> </dcs.With> <dc.Out>TestVar1 is {$TestVar1}</dc.Out>

Output:

TestVar1 is 11.7

Set

The Set operation will override and replace the current value of the target Decimal.

<dcs.Var Name="TestVar1" Type="Decimal" SetTo="12.7" /> <dcs.With Target="$TestVar1"> <Set Value="15.39" /> </dcs.With> <dc.Out>TestVar1 is {$TestVar1}</dc.Out>

Output:

TestVar1 is 15.39

Add

The Add operation will add the amount defined in the Value attribute to the target Decimal.

<dcs.Var Name="TestVar1" Type="Decimal" SetTo="12.25" /> <dcs.With Target="$TestVar1"> <Add Value="15.50" /> </dcs.With> <dc.Out>TestVar1 is {$TestVar1}</dc.Out>

Output:

TestVar1 is 27.75

Subtract

The Subtract operation will subtract the amount defined in the Value attribute to the target Decimal.

<dcs.Var Name="TestVar1" Type="Decimal" SetTo="12.3" /> <dcs.With Target="$TestVar1"> <Subtract Value="15.05" /> </dcs.With> <dc.Out>TestVar1 is {$TestVar1}</dc.Out>

Output:

TestVar1 is -2.75

Multiply

The Multiply operation will multiply the amount defined in the Value attribute by the target Decimal.

<dcs.Var Name="TestVar1" Type="Decimal" SetTo="12.50" /> <dcs.With Target="$TestVar1"> <Multiply Value="3.25" /> </dcs.With> <dc.Out>TestVar1 is {$TestVar1}</dc.Out>

Output:

TestVar1 is 40.6250

Divide

The Divide operation will divide the amount defined in the Value attribute by the target Decimal.

<dcs.Var Name="TestVar1" Type="Decimal" SetTo="12.90" /> <dcs.With Target="$TestVar1"> <Divide Value="3.30" /> </dcs.With> <dc.Out>TestVar1 is {$TestVar1}</dc.Out>

Output:

TestVar1 is 3.909091

TODO - check if Decimal can use Rounding mode on Divide

This operation can also make use of a variety of modes inherited from Java programming language rounding modes using the Mode attribute. (Please see this link for more detailed documentation and examples of the modes.) The available modes are:

UP
DOWN
CEILING
FLOOR
HALF_UP
HALF_DOWN
HALF_EVEN
UNNECESSARY

<dcs.Var Name="TestVar1" Type="Integer" SetTo="12" /> <dcs.With Target="$TestVar1"> <Divide Value="5" Mode="FLOOR" /> </dcs.With> <dc.Out>TestVar1 is {$TestVar1}</dc.Out>

Output:

TestVar1 is 2

Min

The Min operation compares the the current Decimal value with the value defined in the Value attribute and assigns the Decimal with the smaller of the two.

<dcs.Var Name="TestVar1" Type="Decimal" SetTo="12.5" /> <dcs.With Target="$TestVar1"> <Min Value="9.5" /> </dcs.With> <dc.Out>TestVar1 is {$TestVar1}</dc.Out>

Output:

TestVar1 is 9.5

Max

The Max operation compares the the current Decimal value with the value defined in the Value attribute and assigns the Decimal with the larger of the two.

<dcs.Var Name="TestVar1" Type="Decimal" SetTo="12.7" /> <dcs.With Target="$TestVar1"> <Max Value="19.3" /> </dcs.With> <dc.Out>TestVar1 is {$TestVar1}</dc.Out>

Output:

TestVar1 is 19.3

Abs

The Abs operation sets the integer to its absolute value.

<dcs.Var Name="TestVar1" Type="Decimal" SetTo="-12.75" /> <dcs.With Target="$TestVar1"> <Abs /> </dcs.With> <dc.Out>TestVar1 is {$TestVar1}</dc.Out>

Output:

TestVar1 is 12.75