Nicolas Malin created OFBIZ-10108:
-------------------------------------

             Summary: Import file with data-file, add start-line to escape the 
header column line
                 Key: OFBIZ-10108
                 URL: https://issues.apache.org/jira/browse/OFBIZ-10108
             Project: OFBiz
          Issue Type: Improvement
          Components: framework
    Affects Versions: Trunk
            Reporter: Nicolas Malin
            Assignee: Nicolas Malin
            Priority: Minor


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
{code}
ref;date
100;2017-10-10
200;2017-12-11
{code}

This definition failed
{code}
    <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>
{code}
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 :
{code}
    <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>
{code}
I already implemented this on customer site with success



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to