Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Currency

Hi guys.

I got a document that looks like such:

error loading image

Now what want to do is whenever someone selects USD in the currency box, That the amount shows in USD only. When some clicks on AUD then it displays the sales in AUD amounts.

All the currencies need to be multiplied by certain values in order to get the right amount. I have those values but i can't seem to work it out in the script. I have managed to do it seperatly in the table but in needs to be done in the script so that when the selected currency is made then the whole document changes according to that.

Can anyone help me please?

Thanks in advanced

22 Replies
Not applicable
Author

Okay cool. Thanks for the info Nathan. Much appreciated

nathanfurby
Specialist
Specialist

No worries - make sure you post the solution here when you crack it! Big Smile

Not applicable
Author

IF i crack it lol

johnw
Champion III
Champion III


Blaze101 wrote:Is there a way to make it so that if dollars are select than $ is shown, and when Pounds are selected £ is shown, etc?


One approach to a dynamic currency format is to build a table:

Currencies:
LOAD * INLINE [
Currency: Currency Format
RUB: #,##0.00 Rubles;(#,##0.00 Rubles)
USD: $#,##0.00;($#,##0.00)
EUR: €#,##0.00;(€#,##0.00)
] (delimiter is ':');

Then just use num(...,"Currency Format") anywhere you need the dynamic format. This should work in most places, but doesn't work in a straight table. However, I don't ever use straight tables in actual applications, so I don't consider this much of a drawback. I think it's better than a macro solution - more clear what's happening, and doesn't have all the drawbacks of macros.

See attached for updated example.

nathanfurby
Specialist
Specialist

Very nice John. Cool

johnw
Champion III
Champion III

Example expanded with correct use of comma and period in Euros. Not sure what Russian Rubles use, so left as is.

Currencies:
LOAD * INLINE [
Currency: Format: Thousand: Decimal
RUB: #,##0.00 Rubles;(#,##0.00 Rubles): , : .
USD: $#,##0.00;($#,##0.00) : , : .
EUR: € #.##0,00;-€ #.##0,00 : . : ,
] (delimiter is ':');

money(sum(Amount),only(Format),only(Decimal),only(Thousand))

johnw
Champion III
Champion III

For some reason, the web site isn't letting me edit the entry. It lets me do everything and hit post, but then nothing happens. So... new entry.

Created custom money "function" to simplify use in charts.

LET money = 'money($1,only(Format),only(Decimal),only(Thousand))';

Currencies:
LOAD * INLINE [
Currency: Format: Thousand: Decimal
RUB: #,##0.00 Rubles;(#,##0.00 Rubles): , : .
USD: $#,##0.00;($#,##0.00) : , : .
EUR: € #.##0,00;-€ #.##0,00 : . : ,
] (delimiter is ':');

$(money(sum(Amount)))

dvasseur
Partner - Creator III
Partner - Creator III

It's an old thread but same problem so...

I've used the same trick than John has suggested and it's working fine! The only drawback is when you export your chart into Excel. Values are exported as text and not as numbers, so the file is useless (if you export to Excel, most of the time it's to do additional calculations based on QV values).

I'm using QV10 SR2.

Any idea ?

johnw
Champion III
Champion III


David Vasseur wrote:I've used the same trick than John has suggested and it's working fine! The only drawback is when you export your chart into Excel. Values are exported as text and not as numbers, so the file is useless (if you export to Excel, most of the time it's to do additional calculations based on QV values).


I'm not sure what you're referring to. What chart are you exporting? What is coming out wrong? I see that the dates are wrong, as they're exported as a number, but that's the opposite of what you're saying is wrong. I'm using 9SR6 and 10SR1, though, so I suppose it's possible there's a version difference.

This is also older than my most recent modifications to the example. First I'll post what I'd use if the exchange rates are changed at regular intervals - daily, weekly, whatever.

johnw
Champion III
Champion III

And here's what I came up with for exchange rates that are updated at irregular intervals.