views:

670

answers:

1

Background

Users in the US were our application's initial user base, but this has expanded to the point that Canadian, British, and Scandinavian users also use the system.

The PowerBuilder datawindow didn't like the Scandinavian currency format with decimals and periods transposed (###.###,00). When we tried to set the format in the datawindow, it complained, saying something about the format not being valid.

We cannot be the only people that have encountered this problem, but I didn't see a lot about this topic on the usual searches over the Internet.

Our current workaround

For the time being, one of the developers found a workaround, by having the login script change the currency format on the Windows operating system for the session, and putting "[currency]" in the datawindow field's format property to pick up the operating system's format.

This seems to work but is a less than optimal solution in my opinion for a number of reasons.

  1. It requires that our Scandinavian users run the app via a different icon than the other users. I shouldn't have to go into details about how rotten it is to have two different icons to log into the app, plus the maintenance hassles of having each one kick off a different format script.
  2. It only solves the issue of currency formatting for a single currency in a user session. As our app becomes more international, we may need to be able to display a variety of currencies in the same report.

There must be a better way

I'm fairly certain someone will tell me I need to read Spolsky's unicode essay. But aside from that, I'm interested in details on a slicker PowerBuilder solution, if anyone has one. Thanks in advance.

+2  A: 

From PB's help on Defining display formats:

Number and currency settings

To ensure that an application behaves the same in whichever country it is deployed, DataWindow expressions and the masks used in display formats and edit masks require U.S. notation for numbers. That is, when you specify a number in a DataWindow expression or in a number mask, a comma always represents the thousands delimiter and a period always represents the decimal place. You should also always use the $ sign to represent the symbol for currency.

At runtime, the locally correct symbols are displayed for numbers and currency. The comma and period are replaced by the delimiters defined in the user's Number settings in the Regional or International Settings property sheet in the Windows Control Panel. The $ sign in the mask is replaced by the local currency symbol as defined in the user's Currency setting in the Windows Control Panel. For example, in countries where a comma represents the decimal place and a period represents thousands, users see numbers in those formats.

Which is probably not the answer you were hoping to get... What I can suggest is this:

  • For reports, use a computed field that will format the number any way you want, and display it as a string.
  • For input fields, use the built-in currency mask. The user will probably feel more comfortable working with the default system locale anyway.
eran