Objective
This article describes the detailed steps on how to implement currency conversion with the exchange rates from SharePoint List or SQL database or from open exchange rates API (ex: http://fixer.io JSON API) in NINTEX Forms.
Approach
For this demo, I have chosen USD as the output currency that I would like to convert to the amount entered based on the currency chosen. You can make output currency configurable by adding one more currency choice field.
Configuration in NINTEX form
Controls
- Add a Textbox to enter the amount.
- Add a Choice Control to select the currency. Here, I am using currency codes in the choices, few codes shown below.
- Add any of the following controls based on your need to fetch the exchange rate.
- Web Request control to fetch the conversion rate from an open API.
- SQL control to fetch the conversion rate from SQL database.
- Calculated field to fetch the conversion rate from SharePoint List.
- Add calculated field to perform currency conversion.
Control Configuration
Web Request
Configure the control, as shown below in the screenshot.
As we wanted to convert to USD, set the
base currency to USD and
symbols attribute connected to the currency choice control. (I have named the currency choice control as
CurrencyCode.)
http://api.fixer.io/latest?base=USD&symbols=CurrencyCode
Note
XPath for display property does not provide the option to lookup
the control. Thus, just, copy the
CurrencyCode control reference from the Server URL and paste it here and it works.
You shall verify the configuration by clicking Run Now.
SQL Control
Configure the control, as shown in the screenshot given below.
Calculated Field (fetch exchange rate)
Configure the control, as shown in the screenshot given below.
Here, we will use lookup function to fetch the exchange rate from the list.
lookup(list title, column to filter on, value to filter on, output column)
Calculated Field (currency conversion)
Configure formula to convert the currency.
Amount (USD) = Amount/Exchange Rate
I hope you found this article informative.