Wednesday, July 26, 2006

Currency Conversion in Dicom

Currency in Dicom is treated like any another physical quantity (like mass, length, time, etc.). So syntax to convert one currency from another is same as you convert units.

Example:
10 USD to EUR

The above will convert 10 US dollars to Euro. Note that Dicom's 3 character long currency symbols are standard ISO symbols that are also being used by renowned systems like xe.com, SAP, etc.

One advantage of treating currency as another physical quantity is, you can calculate expression that involves currency along with other units.

Example:
10 USD/mi to EUR/km

Updating Currency Rate

Needless to say that Currency value is ever changing. So, you need to update currency rate. In Dicom it is plain and simple, you just assign the new value.

Example:
1 EUR = 1.1 USD
1 GBP = 1.7 USD

Unfortunately, version 4.0 do not automatically update currency from internet. You can, however still update using a batch file.

Updating Currency Rate in a Batch

Write down all your currency assignments as in the example above in a text file. You can use notepad to edit your file. You may separate each assignment either by newline or by semicolon.
Save your file.

In Dicom calculator enter the following command:

RUN '<input file>'

Replace <input file> with the actual path and filename. Single quotes are required. Press enter. Dicom will update the currencies as instructed in the file.

Dicom's RUN command can take an optional output file name, like:

RUN '<input file>' '<output fle>'

You may use the above syntax to check out the results and errors if any. You may collect up to date currency rate from www.xe.com.

Note:
You may use RUN command for other purposes also e.g. to set up Dicom environment. The input file is not a Dicom document file but a batch of calculator commands and expressions. So input file content should be simple text file containing barebone commands, expressions and functions (without any document tags and document specific commands) that you can execute from Dicom calculator.