Smart Buttons
Controls/XML Elements
Arithmetical Operation <ArithmeticalOperation>
ArithmeticalOperation calculates either static numbers or variables.
Configuring
To configure with the Arithmetical Operation XML Generator:
-
Open the Smart Buttons Editor to create a script.
-
Click Arithmetical operation <ArithmeticalOperation> to display the Arithmetical Operation Editor.
-
Configure the attributes.
Attribute
Description
Variable name
Name the variable that will hold the calculation result.
Decimal digits
Select the number of decimal digits for the final number.
Arithmetical expression Enter the calculation. Use:
-
Either static numbers or variables in square brackets [].
-
The following symbols:
Operation
Symbol
Addition + Subtraction - Multiplication * Division / Force decimal digits Forces decimal digits for all resulting numbers:
-
If selected, if the result number is an integer, such as 100, the number is always returned the number of digits selected in Decimal digits. If Decimal digits is set to 2, the result is displayed as 100.00.
-
If unselected, and the result is integer, even if Decimal digits is set to 2, the returned value does not contain decimal digits (zeros). The integer 100 is returned as 100.
-
-
Click SUBMIT.
Example
The following script:
-
Reads all Filed Fares (stored fares) from a PNR/Booking File.
-
Adds 20% to the stored fare.
-
Displays the updated fare on the screen.
<ButtonConf ButtonName="GDS Variable-FiledFares +Arithmetical Operations" Description="" QuickCommand="">
<Variable VarName="TotalAmount">%ListOfFiledFares({TotalAmount})%</Variable>
<ShowMessage>Your Filed Fares: [TotalAmount]</ShowMessage>
<ForEach>
<ElementsList>
[TotalAmount]</ElementsList>
<Action EasyMode="False">
<ArithmeticalOperation VarName="TotalAmountPlus20percent" DecimalDigit="2"
ForceDecimalDigit="True">[@]*1.2</ArithmeticalOperation>
<ShowMessage>Fare plus 20%: [TotalAmountPlus20percent]</ShowMessage>
</Action>
</ForEach>
</ButtonConf>