8 Replies Latest reply: Apr 5, 2013 2:02 AM by Hari_639 RSS

    IR Download - Set CSV Separator Dynamically

    Hari_639
      Dear All,

      I'm trying to set CSV Separator for IR Download dynamically based on user selection. Pop-up help of "CSV Separator" under "Report Attributes" is as follows..
      Identify a column separator. If no value is entered, a comma or semicolon is used depending on your current NLS settings.
      So I have tried creating "On Load Before Header" page process to set NLS settings based on user selection.

      Process Point: On Load - Before Header
      Run Process: Once Per Page Visit (default)
      Condition Type: PL/SQL Expression
      Expression 1: :REQUEST IN ('CSV','HTMLD')
      Process:
      IF :P0_SEPARATOR = ';' THEN
           EXECUTE IMMEDIATE('ALTER SESSION SET NLS_LANGUAGE = GERMAN');
           EXECUTE IMMEDIATE('ALTER SESSION SET NLS_TERRITORY = GERMANY');
           EXECUTE IMMEDIATE('ALTER SESSION SET NLS_NUMERIC_CHARACTERS = '',;''');     
           APEX_DEBUG_MESSAGE.LOG_MESSAGE('set to German');
      ELSE -- Separator is ,
           EXECUTE IMMEDIATE('ALTER SESSION SET NLS_LANGUAGE = AMERICAN');
           EXECUTE IMMEDIATE('ALTER SESSION SET NLS_TERRITORY = AMERICA');     
           EXECUTE IMMEDIATE('ALTER SESSION SET NLS_NUMERIC_CHARACTERS = ''.,''');          
           APEX_DEBUG_MESSAGE.LOG_MESSAGE('set to American');
      END IF;
      However, irrespective of value of 'P0_SEPARATOR', I always get "Comma" as separator. Can someone advise what could be the issue?

      APEX Version: 4.0.2.00.07
      DB: Oracle 11G R2
      WebServer: EPG
      Application Primary Language: English (En)

      Application is NOT multilingual.

      Regards,
      Hari