1. Manos Miliaras
  2. PowerBuilder
  3. Monday, 23 July 2018 08:05 AM UTC


I am trying to import data to a datawindow from a tab separated text. The problem is our country's regional settings are set to "," for the sDecimal and "." for the sThousand symbols. When i use the dw_1.importfile we need those settings to be the other way round "." for the sDecimal and "," for the sThousand. If i change those settings from intl.cpl advanced settings and press ok the import works fine. Since i want to automate that procedure so that our users don't have to manually do it i tried doing it by changing the registry values (also tried all combinations of those changes):

    RegistrySet("HKEY_CURRENT_USER\Control Panel\International","sDecimal", ".")
    RegistrySet("HKEY_CURRENT_USER\Control Panel\International","sThousand", ",")
    RegistrySet("HKEY_USERS\Control Panel\International","sDecimal", ".")
    RegistrySet("HKEY_USERS\Control Panel\International","sThousand", ",")

The values change just fine, even the window settings in intl.cpl show the new values are inserted BUT when i try to use the dw_1.mportfile the import fails with the exact same behaviour as if the values were set to the original settings. I m not sure if this is a microsoft problem or powerbuilder problem. I tried searching if the windows settings write anywhere else in the registry or in any other file but couldn't find anything with tools like ProcessMonitor and RegShot.

Any help/input would be appreciated.

Accepted Answer
Brad Mettee Accepted Answer Pending Moderation
  1. Monday, 23 July 2018 12:58 PM UTC
  2. PowerBuilder
  3. # Permalink

Good morning,

I think there are two problems here, you shouldn't be directly modifying the registry, and you need to notify the system there's been a change to the settings. It's possible you only need the notify portion, but whenever possible, it's usually best to not modify the registry directly.

I researched changing Locale info at MSDN, but don't have Powerbuilder code to make the changes.

Here's a link to SetLocaleInfoW

Note: When using SetLocaleInfoW (unicode version), the first parameter is always ignored.

The link for WM_SETTINGCHANGE is in the first paragraph of the page above.


  1. Manos Miliaras
  2. Tuesday, 24 July 2018 13:00 PM UTC

Indeed you were right it was about notifying the system that there was a change. I managed to solve my problem with your help.

  1. Helpful
There are no comments made yet.
Manos Miliaras Accepted Answer Pending Moderation
  1. Tuesday, 24 July 2018 12:49 PM UTC
  2. PowerBuilder
  3. # 1

Issue resolved thanks everyone.

There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 23 July 2018 13:06 PM UTC
  2. PowerBuilder
  3. # 2

Hi Emmanouil ;

  Here is some more information on the SetLocaleInfoW command that Brad mentioned - with a coding example:



Regards ... Chris

  1. Brad Mettee
  2. Tuesday, 24 July 2018 00:53 AM UTC
Nice find Chris.
  1. Helpful
  1. Manos Miliaras
  2. Tuesday, 24 July 2018 12:52 PM UTC

As Brad already mentioned it was indeed a problem about notifying the system about the changes. With both of your help and your specific link i managed to make it work.

  1. Helpful
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Monday, 23 July 2018 13:03 PM UTC
  2. PowerBuilder
  3. # 3

Hi, I had the same problem many times. In enterprise environments you may see that user has very limited chance to manipulate regional settings. Sorry for not having a quick fix because PowerScript is very consistent in following regional settings.

Last week I needed to convert some latitude/longitude values from GeoJSON text to decimal representation for calculation purposes. GeoJSON uses point as decimal separator but most of my users at runtime would use comma.

Q: How do I convert my text so it follows the rules expected by PowerScript?


char ic_decPoint = ' '

// Just-in-time identify the decimal separator
// No need to identify more than once

if ic_decPoint = ' ' then ic_decPoint = Mid( String(1.23), 2, 1)

if ic_decPoint <> '.' then
   ls_lat = of_ReplaceAll(ls_lat, '.', ic_decPoint)
   ls_lng = of_ReplaceAll(ls_lng, '.', ic_decPoint)
end if

ldec_lat = Dec(ls_lat)
ldec_lng = Dec(ls_lng)

Q: I have to handle long text instead of just one value at a time - how do I proceed?
A: You may need to split your text, convert numeric segments, join back together, and then import.

HTH /Michael


  1. Manos Miliaras
  2. Tuesday, 24 July 2018 12:57 PM UTC

Your code changes the dots with commas. It was one solution in mind but not the preferable one since we didn't really want to change the dots and commas before the import.

Thanks for your input.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1

There are no replies made for this question yet.
However, you are not allowed to reply to this question.