Get Free Trial
Get Free Trial

what can be delimiter in ocsv except ‘,’ and ';' ?

Mr.xu asked on August 21, 2019

Our team want to use ‘^’ or ‘~’ to be delimiter like this:
char delimiter = ‘~’;
InputStream inputStream = Compressor
.compressStream(new ByteArrayInputStream(caption.toString().getBytes(“utf-8”)), delimiter);
but font page can’t distinguish the delimiter.

5 answers

Public
Ian Sadovy Flexmonster August 21, 2019

Hello,
 
Thank you for the question.
Please note that the output delimiter for OCSV should be always ,.
The second argument of the compressStream function specifies the delimiter of the input data.
 
If you want to send the data with another delimiter, please use the CSV data format (without Compressor). Also, you will need to specify the delimiter on the client-side using dataSource.fieldSeparator parameter in the report. 
 
Hope it helps.
 
Regards,
Ian

Public
Mr.xu August 22, 2019

Thank you for your answer,but in my project,we can use “;” to be delimiter for OCSV ,it’s useful.So i want to find another character to  be delimiter.Because our customer are used to do bills with ‘;’

Public
Tanya Gryshko Flexmonster August 22, 2019

Hello,

Thank you for your reply.

Could you please specify more details about your use case? Knowing what you are trying to achieve would greatly help us. Also, we would like to know where your data is stored and how it is passed to Flexmonster.

Waiting for your reply.

Regards,
Tanya

Public
Mr.xu August 23, 2019

Our case like this in java:
   StringBuilder caption = new StringBuilder();
 
   if (0 < entitys.size()) {
  
    caption.append(“+StrockOrgCd;”);
    caption.append(“+StrockOrgNm”);
    
    caption.append(“\n”);
    for (StoreInOutSaleAnalyseDomain n : entitys) {
     caption.append(n.getStockOrgCd());
     caption.append(“;”);
     caption.append(n.getStockOrgNm());
     caption.append(“\n”);
    }
    char delimiter = ‘;’;
    InputStream inputStream = Compressor
      .compressStream(new ByteArrayInputStream(caption.toString().getBytes(“utf-8”)), delimiter);
    caption = null;
   
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    int len = 1024;
    byte tmp[] = new byte[len];
    int i;
    while ((i = inputStream.read(tmp, 0, len)) > 0) {
     baos.write(tmp, 0, i);
    }
and in js:
       flexmonster.connectTo({
         dataSourceType: ‘ocsv’,
         filename: xxxAPI.queryCompressor + queryParam,
         fieldSeparator:’;’
       });

Public
Vera Didenko Flexmonster August 23, 2019

Hello,
 
Thank you for providing more details.
 
 
For your case, our team kindly suggests loading the CSV data without using the compressor.
 
For example, in Java:



InputStream inputStream = new ByteArrayInputStream(caption.toString().getBytes(StandardCharsets.UTF_8));
caption = null;

and in js:

flexmonster.connectTo({
dataSourceType: "csv",
filename: xxxAPI.queryCompressor + queryParam,
fieldSeparator:";"
});

 
Please let us know if this helps to solve the problem.
 
 
Best Regards,
Vera

Please login or Register to Submit Answer