Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-10108

Import file with data-file, add start-line to escape the header column line

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Implemented
    • Affects Version/s: Trunk
    • Fix Version/s: 17.12.01
    • Component/s: framework
    • Labels:
      None

      Description

      When you load a CSV file some time with a data-file definition, if it contains some header column you can use the format attribute of you column.

      Example

      ref;date
      100;2017-10-10
      200;2017-12-11
      

      This definition failed

          <data-file name="MyCsvTest" separator-style="delimited" type-code="text" delimiter=";">
              <record name="Test">
                  <field name="ref" type="String" position="1"/>
                  <field name="date" type="CustomTimestamp" format="yyyyy-MM-dd" position="2"/>
              </record>
      

      You need to read the date as string and after convert it on your code to escape the first line.

      To solve it I propose to add a new attribute start-line like this :

          <data-file name="MyCsvTest" separator-style="delimited" type-code="text" *start-line="1"* delimiter=";">
              <record name="Test">
                  <field name="ref" type="String" position="1"/>
                  <field name="date" type="CustomTimestamp" format="yyyyy-MM-dd" position="2"/>
              </record>
      

      I already implemented this on customer site with success

        Attachments

          Activity

            People

            • Assignee:
              soledad Nicolas Malin
              Reporter:
              soledad Nicolas Malin
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: