Export data store entity to CSV, quotation marks (',") automatically added in the generated csv file

Certified Senior Developer

Hi ,

we are using Export Data Store Entity to csv smart service (pipe delimited) and for few columns ' and " prefixed/suffixed in the generated csv file even though it does not exist in the actual data.

Below is sample data:

-  Phone number in the database is started with +, but generated excel column has ' prefixed

- Actual text in the database doesn't have the " but there " prefixed and suffixed in the generated execl. 

Observed ' is appended when there is + in the beginning of the string and " are getting appended in a couple of scenarios.

Is this the expected behavior of plugin? how can we avoid these characters?  pls advice.

  Discussion posts and replies are publicly visible

Parents
  • Note this is an OOTB service, Export Data Store Entity to CSV (vs a plugin as noted), and I do not believe we have the ability to avoid these characters using the service.

    I'm actually not familiar with the single quote prefix, but double quotes are generally added to text values so that if your delimiter is used (typically a comma) within the text value, the quote-wrapped values will be treated as one as to not cause unexpected behavior (erroneous extra elements in that row).

    One suggestion, depending on what you are doing with the file.  We generally only create CSV files for export, so I will utilize the Text Doc from Template service (only one placeholder for ###input### in the document), and generate the CSV data manually such as below.  This does create a TXT file, but when we SFTP them out we can change to CSV.  That is the only node I believe I'm aware of where we can change the extension of a document however.

    a!localVariables(
      local!header: concat("ID,value1,value2",char(10)),
      local!delimiter: ",",
      local!data: {
        {id: 1, value1: "testA", value2: "testB"},
        {id: 2, value1: "testA", value2: "testB"},
        {id: 3, value1: "testA", value2: "testB"}
      },
    
      reduce(
        concat(_),
        local!header,
        a!forEach(
          items: local!data,
          expression: concat(
            fv!item.id,",",
            stripwith(fv!item.value1,","),",",
            stripwith(fv!item.value2,","),",",
            char(10)
          )
        )
      )
    )
    

Reply
  • Note this is an OOTB service, Export Data Store Entity to CSV (vs a plugin as noted), and I do not believe we have the ability to avoid these characters using the service.

    I'm actually not familiar with the single quote prefix, but double quotes are generally added to text values so that if your delimiter is used (typically a comma) within the text value, the quote-wrapped values will be treated as one as to not cause unexpected behavior (erroneous extra elements in that row).

    One suggestion, depending on what you are doing with the file.  We generally only create CSV files for export, so I will utilize the Text Doc from Template service (only one placeholder for ###input### in the document), and generate the CSV data manually such as below.  This does create a TXT file, but when we SFTP them out we can change to CSV.  That is the only node I believe I'm aware of where we can change the extension of a document however.

    a!localVariables(
      local!header: concat("ID,value1,value2",char(10)),
      local!delimiter: ",",
      local!data: {
        {id: 1, value1: "testA", value2: "testB"},
        {id: 2, value1: "testA", value2: "testB"},
        {id: 3, value1: "testA", value2: "testB"}
      },
    
      reduce(
        concat(_),
        local!header,
        a!forEach(
          items: local!data,
          expression: concat(
            fv!item.id,",",
            stripwith(fv!item.value1,","),",",
            stripwith(fv!item.value2,","),",",
            char(10)
          )
        )
      )
    )
    

Children