Sun Nov 17, 2019 9:50 am
Login Register Lost Password? Contact Us


Using Ý as CSV HEADER separator

Comments and questions related to the Enterprise Control Language

Thu Aug 04, 2016 8:59 am Change Time Zone

Hi,

We have a requirement to output a CSV from THOR using 'Ý' as a separator,
Capital Y with Acute. Unfortunately I am unable to use this separator for the column headers, but works ok for every other row in the csv.

Any ideas?

The following BWR illustrates my approach to get UPPERCASE headers and custom separator.

Code: Select all
myRec := record
   string4 f1;
   integer1 f2;
   string1 f3;
end;


writeCSV(_ds, _filename, _sep) := functionmacro
   // KLUDGE to output uppercase headers, and use specific separator
   output(dataset([],recordof(_ds)),,_filename+'_headers',overwrite,csv(heading(SINGLE),separator(_sep),quote('"'),terminator('\r\n'),UNICODE));
   headerRow := dataset(_filename+'_headers',{String line},csv(heading(0),separator('|'),quote('"'),terminator('\r\n'),UNICODE));

   // use UPPER case headers as headertext and write out UTF-8/16 CSV
   return output(_ds,,_filename,overwrite,csv(heading(STD.STR.ToUpperCase(headerRow[1].line),single),separator(_sep),quote('"'),terminator('\r\n'),UNICODE));
endmacro;


ds := dataset(
   [
      {'aaaa',1,'A'},
      {'bbbb',2,'B'},
      {'cccc',3,'C'}
   ],
   myRec
);
      
writeCSV(ds, '~afarrell::20160803::csvtest',U'Ý');

afarrell
 
Posts: 14
Joined: Fri Nov 07, 2014 2:39 pm

Thu Aug 04, 2016 6:29 pm Change Time Zone

afarrell,

You should submit this issue to JIRA.

HTH,

Richard
rtaylor
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1485
Joined: Wed Oct 26, 2011 7:40 pm

Fri Aug 05, 2016 8:20 am Change Time Zone

Will do Richard,

Thanks,

-A
afarrell
 
Posts: 14
Joined: Fri Nov 07, 2014 2:39 pm


Return to ECL

Who is online

Users browsing this forum: No registered users and 1 guest

cron