- 08 Apr 2021
- 3 Minutes to read
- Print
- DarkLight
Currency Formatting and Exchange
- Updated on 08 Apr 2021
- 3 Minutes to read
- Print
- DarkLight
Overview
As means to improve cross-cultural communication and to expand the market, Decisions offers a host of Localization options. These options allow the ability to format things such as Language, Date Times, Currency, and Holiday schedules, based on a user's location settings.
One such available tool comes in the form of the Foreign Exchange Module. This Module acts as an interaction between Decisions and a CurrencyLayer.com Account. This helps to allow users to utilize the tool for financing tasks that involve the need for currency exchange.
Example
- From the Decisions Studio, navigate to System > Administration > Features; then, install the ForeignExchange Module.
- Navigate to System > Settings, then locate and select Foreign Exchange Settings; input the CurrencyLayer.com API Key that corresponds to the used CurrencyLayer Account, then click SAVE.
- From a Designer Folder, select CREATE FLOW, choose Default, provide a Name, then click CREATE.
- From the Flow Designer, attach a Show Form step from the Favorite Steps category of the Steps tab. From the Properties tab of the Show Form step, select Pick or Create Form, provide a Name, then click CREATE.
- Design a Form using a Number Box, two Text Box components, a Button, and three Labels. Select each Text Box to navigate to their Properties; under Behavior, change Maximum Length to "3". Save and Close the Form.This Form will serve as the input Form for both the amount of a currency, the original form of currency, and the desired converted currency type. Limiting the character length ensures that a user only types the required number of characters for a supported CurrencyLayer currency.
For a list of supported currencies, see:
CurrencyLayer Supported Currencies Back in the Flow Designer, navigate to the Input Form's Properties and set each item under Inputs to Ignore.
Setting each Input to Ignore allows the user to enter their own value upon running the Form.From Steps > Integration > Foreign Exchange and attach a Do Conversion step to the Form step. On the newly added step, navigate to Properties > Inputs and define each Input.
Map this step as follows:- Map the Output from the Amount box on the Form to its respective Input.
- Map the Original Currency box Output to From.
- Map the Desired Currency box Output to To.
Attach an additional Show Form step to the Do Conversion step; from the Properties tab of this step, select Pick or Create Form and Create another Form.
Design a Form containing a single Text Box, a Number box, a Label, and Button. Then, Save and Close the Form.
This Form serves as a display for the converted amount. The Text Box displays the converted Currency Type and the Number Box displays the converted numerical value. The Button serves as a Done Button.- Back in the Flow Designer, attach the Done path to End step.
- Navigate to the Display Form's Properties; map DoConversion1_Ouput to Converted Amount [Number Box] and DesiredCurrency to Converted Currency [Text Box].
- Save the Flow, then if desired, Close the Designer.
Debug
- From the Flow Designer, click the Debug link on the top action bar, then select FULL.
- When the Flow runs, upon reaching the Currency Input Form, input the numerical Amount, the original 3 character Support Currency type, and the Desired Currency type for conversion, then click the Convert Button.Clicking Convert will cause the Flow to proceed to the Display Form which will display the Converted Amount with the new Currency Type.
Get Conversion Rate
To use the Get Conversion Rate step:
- From the Flow Designer, navigate to the Steps tab and navigate to Integration > Foreign Exchange.
- Attach a Get Conversion Rate step to the Start and End steps.
- From the step's Properties tab, map the desired starting 3 character supported Currency Type to the From Input, and the desired converted Currency Type to the To Input.
- Save the Flow, then if desired Close the Designer.
- Debug the Flow.
- Once the Flow runs, navigate to Get Conversion Rate 1 > Execution 1 > View Input/Output Data.The resulting data will display the Conversion rate from one unit of the Currency Type to its equivalent amount in the To Currency Type.