This site has been destroyed by Google forced upgrade to new way of WEB site.
All files links are not working. Many images has been lost in conversation.
Have to edit 190 pages manually. Will try to do ASAP but for this I need time ...
THANK YOU GOOGLE !

Tuesday, June 19, 2012

NLS problem in Apex flash charts

Recently I had a situation to work with Apex Flash Chart graphs on Apex 4.1.

I was surprised when I saw that all number formats in flash graphs are using American NLS number format-decimal separator "." and group separator ",". Because I live in Croatia, where decimal and group separator signs are contrary, I was searching to find a solution to get a proper display of number values in flash charts.

The try

I was trying several things to work that out:
  • Set default language in browser to Croatian.
  • Set "Initialization PL/SQL Code" option (from Home|Application Builder|Application xxx|Edit Security Attributes) to:
    alter session set NLS_NUMERIC_CHARACTERS=',.'
  • Try formatting values for chart
But they all failed-with no success. Decimal point was all the time "." and group operator was "," as decimal.

The solution

Then I realize that flash chart is independent piece of code running in Apex through it's external definition, in XML part of chart setting. Looking closely what is written there lead me to solution. Goto Home|Application Builder|Application xxx|Page yyy|Flash Chart Attributes, where your flash chart is placed.

Find Chart XML section and change Use Custom XML->Yes.

Then in next (enabled) XML section whith default values as:
<labels enabled="true" position="Outside">
  <font family="Tahoma" size="10" color="0x000000" />
  <format><![CDATA[{%Value}{numDecimals:2,decimalSeparator:\,,thousandsSeparator:.}]]></format>
</labels>
change highlighted row to:
<labels enabled="true" position="Outside">
  <font family="Tahoma" size="10" color="0x000000" />
  <format><![CDATA[{%Value}{numDecimals:2,decimalSeparator:.,thousandsSeparator:\,}]]></format>
</labels>
Result is finally as expected, graph with proper nls format setting

The End

Because Oracle is in total control of session values, I think that this code should be generated dynamically to follow real nls format values. Especially that this solution doesn't cover translated applications where such a setting is hard codded for all languages!

Hope this helps someone.

Cheers!

No comments :

Post a Comment

Zagreb u srcu!

Copyright © 2009-2018 Damir Vadas

All rights reserved.


Sign by Danasoft - Get Your Sign