2 Replies Latest reply on Oct 13, 2015 8:28 AM by hanstrager

Is there a simple way to make a total when having different currencies

I have a database where I need to calculate different prices for certain products.

I have got 4 different parameters when these gets added up, I have the total of a product in £.

Sometimes these parameters are given in the form of either € or \$, so I've made switch boxes for every single parameter - so i a radio button can decide whether the parameter price comes in £, € or \$.

I then have a total which converts all this into a total in pounds. Is there a way to do this in one calculation field? or should i make in between calculations for every parameter (to decide whether what the currency is in pounds) and then have the total add all these in between calculations? or is there a better way of doing this?

• 1. Re: Is there a simple way to make a total when having different currencies

hanstrager wrote:

I then have a total which converts all this into a total in pounds. Is there a way to do this in one calculation field?

I would create one calc field that gives you a unified amount

// cUnifiedAmount =

Let (

exchangeRate =

Case (

currency = "£" ; 1 ;

currency = "€" ; 1.05 ;

currency = "\$" ; 1.10

) ;

amount * exchangeRate

)

then summarize that field.

Even easier if you create a table with currencies and an exchange rate and use that as a lookup table, since then you'd only need

// cUnifiedAmount =

amount * Currency::exchangeRate

and use that as an auto-enter option, so the amount is calculated based on a the current rate (assuming that you maintain/update the Currency table).

• 2. Re: Is there a simple way to make a total when having different currencies

Currently I'm using a 2 global fields for exchange rate, and have them placed on all my layouts as i quickly can update them when needed. These are called currencyD and currencyE.

Can Implemented like this:

Case (

currency = "£" ; 1 ;

currency = "€" ; currencyE ;

currency = "\$" ; currencyD

);

Can't figure out what field exchangeRate should be?