November 12, 201015 yr I've come up with a kludge to handle this by converting to text and fiddling, but there must be a more elegant way to handle it. I sell books, and depending on what nation they are sold in, the amount may come with two digits to the right of the decimal (like US$), or not (like Japanese yen). It would be convenient to be able to automatically change the format of the prices on invoices and such based on a simple switch for "yen or dollars." Each book has a specific yen price and a specific dollar price set individually. Any ideas for a simple way to implement it?
November 12, 201015 yr You can define a calculated field, and set it to Round ( Amt1; Digits_to_Round_to) Be sure to uncheck do not replace existing value; this way, it will update value when digits_to_round_to changes. To automatically fill based on country, and prefix the amount with appropriate currency symbol, the calculated field might read Case(Country="Japan";"¥" & Round(Yen_Amt,0);Country="US"; "$" & Round(Dollar_Amt,2);"Amt Unknown because country not recognized") If there are many countries, the logic could instead use a lookup on a related database for currency symbol and digits.
November 12, 201015 yr there must be a more elegant way There is, but not in version 8.5. Try something like: Case ( Currency = "US" ; "$" & Int ( DollarPrice ) & SerialIncrement ( ".00" ; 100 * Mod ( DollarPrice ; 1 ) ) ; "¥" & YenPrice ) Note that this assumes your prices are already rounded as appropriate for each currency.
November 15, 201015 yr Author This appears to work fine... I have to confess I don't completely understand what you just did, but I'll figure it out. And it is easily adaptable to multiple currencies! Thank you!
Create an account or sign in to comment