Focal Point
[CLOSED] how to detect regional list separator via javascript to fix CSV formats

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/8407090076

April 10, 2014, 11:55 AM
jodye
[CLOSED] how to detect regional list separator via javascript to fix CSV formats
Hi All

We permit users to export reports as CSV. If your regional settings are in english, everything works fine.. click on the file and it opens in excel.

If your regional settings are in french (as many of our users are), then excel does not automatically open. The problem is that the regional setting is set to a semicolon as the list separator instead of a comma.

Obviously, in excel the user can import the file and indicate the delimiter... but we want to avoid that step for him.

So we need the following to happen.

- detect user's regional setting
- if comma separator then normal format comt export
- if semi colon then we will create a format alpha file with semi colons between the fields and call it .csv (unless there is a way in webfocus to set the list separator in comt).

In either case, we need to determine the regional setting. I found some javascript but unfortunately it only works in IE, which I guess is not surprising.

var list = ["a", "b"];
var listSeparator = list.toLocaleString().substring(1, 2);
alert(listSeparator);

I changed my settings and that gives me a semi colon in IE but a comma in chrome and FF.

Does anyone have any ideas as to how to detect the regional settings in ff and chrome? I am thinking it is a security issue and will not be possible.

Thanks

Jodye

This message has been edited. Last edited by: <Kathryn Henning>,


WF 8.0.0.5M
April 10, 2014, 01:24 PM
dhagen
You can define the deliminator when you create the file in WF. It is just a delimited file.

Do this at the WF server level. You may have to the WF_Language parameter to the server. I can't remember if the WF local parameter is actually called WF_Language, but I'm pretty sure you can find that easily enough.


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
April 10, 2014, 01:26 PM
njsden
Please have a look at this .

It suggests to expose HTTP_ACCEPT_LANGUAGE as a variable via WebFOCUS Client's site.wfs

Once you get the configuration right, you .fex can "see" &HTTP_ACCEPT_LANGUAGE and somehow determine whether English or French is used and it's all all Dialogue Manager/WebFOCUS fron that point on Smiler



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
April 10, 2014, 01:36 PM
njsden
You may start with adding the following under WebFOCUS Administration Console / Configuration / Custom Settings:

<SET>HTTP_ACCEPT_LANGUAGE(pass)


Then, in a .fex look for &HTTP_ACCEPT_LANGUAGE. This is what I got when running on my PC:

-TYPE &HHTP_ACCEPT_LANGUAGE


Result:
en-US




Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
April 11, 2014, 01:14 PM
jodye
Hi Guys

Thanks for the answers.

Unfortunately that won't help. We already know what language they want. Our portal is completely bilingual.

The problem is that the language used to browse the portal is not necessarily the same as the language of the regional settings or the OS. It happens all the time. A user has english settings but is browsing the portal in french.

Ideally, we really need access to the regional settings. I think it is impossible though for ff and chrome. Maybe we need to ask the user "hey what do you want to use as your csv separator?"

:-)

Thanks

Jodye


WF 8.0.0.5M
April 15, 2014, 12:53 PM
dhagen
Look here


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
April 15, 2014, 04:39 PM
susannah
yeah, use a multi-drill, on whatever link it is that you allow them to click on.
'do you want your csv with commas' and 'or with semicolons?'
and then use instead of PCHOLD FORMAT COMMA
use FORMAT DFIX with the DELIMITER defined as whichever.
'regular' or 'extra crispy'...




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
April 15, 2014, 11:51 PM
njsden
quote:
'extra crispy'

I like that Smiler



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.