Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Currency Conversion

LeenaInfy
Level 1
Level 1

Hi  All

I have a field on the Form where user enters currency in numbers and a dropdown where he selects the currency( options may be all foregin currency like USD, Yen, etc etc).

The problem statement is that I want to convert the currency into Dollars while storing in backend,Any idea what would be the best way to implement this.If we put a javascipt formula then the problem would be that the exchange rate keeps on changing.Another approach would be to store the exchange rate in DB or in configuration.

Kindly assist.

Thanks in advance,

Regards,

Leena Jain

2 Replies
_Bruce_Robertson
Level 10
Level 10

Hi Leena Jain,

I've a couple of suggestions.  Yahoo have a webservice you can use, but you might want to check the terms and conditions.  Here is a sample calling the API.  If you can't use the Yahoo webservice then the sample should get you started calling any webservice returning a JSON result.  https://sites.google.com/site/livecycledesignercookbooks/home/YahooAPI.pdf?attredirects=0&d=1

(there are probably more currencies supported by Yahoo, I've only loaded a sample into the drop down controls)

Another option would be to load a xml file from a webserver, this sample loads the European Central Bank file they produce after each trading day.

https://sites.google.com/site/livecycledesignercookbooks/home/European%20Central%20Bank.pdf?attredir...

(I don't believe there is any restrictions on accessing this file, but it only includes a subset of currencies ... still this sample would be easily modified to handle your own xml file) ... check the preOpen event.

(Both samples might give you warning messages depending on your installation configuration, but offer the "Don't ask again" option.

Regards

Bruce