easycatalog_currency_conversion

Real time Currency Conversion within Adobe InDesign

If you are working with financial data within Adobe InDesign in order to build catalogs, financial reports or menu maybe, you may need to convert prices from one currency to another.

Of course, you shouldn’t have to deal with currency conversion as it is your client ‘s responsibility to provide them.  But you end up in charge of the conversion of the 5000 prices in euros in US dollars within your indesign document.

What a tedious task. Put the calculator away, we are going to change all our prices in a blink. Ice on the cake : In Real Time ! Prices conversion is not your nightmare any longer.

A) Nice euros prices

We are going to generate a dummy and really basic list of prices thanks to this website : generatedata
This is a really useful website for one looking for building quick and small databases.

Donnes avec prix pour change

The last column hosts our euros prices. We want to convert them in dollars in real time with very few effort. We will use the EasyCatalog plugin and one of its unrecognised yet powerful feature : the call to a javascript script !

B) Javascript Script

Our script is going to execute a HTTP request toward this website :  rate-exchange.appspot.com thanks to a Socket Object. I take this opportunity to thank our great friend and colleague Martinho da Gloria from Automatication for delivering a code designed for http requests.

You can also use a script from ChrisKoppieters at Rorohiko : GetURL This script allows you to interrogate useful urls for as long you are not behind a proxy.

All we have to now is to use this script with EasyCatalog.

C) EasyCatalog & Javascript

We will create a custom field, named “Prix en dollars US” and we will use the “CALLSCRIPT” function:

custom field with call script

D) Result

Et voilà, in a blink, all our euro prices are converted in US dollars :

euros convertis en dollars

What’s great here is that our dollars prices are dynamically linked to the “Prix” column values. If any value is subject to changes, then the price will be automatically converted again ! Our document can then be updated very easily !

E) Conclusion

Once again a graphic designer has not to deal with prices conversions. The clients has to. However we wanted to demonstrate through this example the feasibility of a real time currency conversion within InDesign thanks to the advanced features of EasyCatalog.

Advanced users will wonder why choose to call a script rather than using the MUL (multiple by) function and use a static value ? You can certainly do that with the same result. No worries. Our intention here was to push back the limits of the EasyCatalog/Javascript combination.

While preparing this post, we wondered what could be a prime example of using a javascript with EasyCatalog. What would justify teh call to a javascript file. How could javascript extend the use of the EasyCatalog plugin ? We think that interrogating a http service can be a good example.

In our case, more than a currency conversion, we bring reactivity as the ratio is calculated in real time. A Stock Market crash, a skyrocketing share, a supply shortage and eventually rates going up and down ? In a blink all the prices are calculated over without the need of looking for the rate at this time.

Also, some websites offer to do currencies conversion regarding to specific past rates. This may be interesting for who may ever want to do comparison in prices evolution from one date to another. And who knows : generate a nice bar graph ?

Leave a Reply

Your email address will not be published. Required fields are marked *