Customer Portal

Delimited FlatFile reader - Question from New User

Comments 4

  • Avatar
    jausperger
    0
    Comment actions Permalink
    Hello,

    delimited reader defines only line and field delimiter, more complicated structure isn't possible. To be able to skip some substring you need append a reformat component.

    Try something like this:

    <Node id="REF" type="REFORMAT">
    <attr name="transform">
    import org.jetel.*;

    public class reformatOrders extends DataRecordTransform{
    DataRecord source,target;
    int counter;
    String message;

    public boolean transform(DataRecord[] _source, DataRecord[] _target){
    source=_source[0]; target=_target[0];
    try{
    SetVal.setInt(target,"orderid",GetVal.getInt(source,"orderid"));
    message = GetVal.getString(source,"messagecomment")
    // some operation over message
    SetVal.setString(target,"messagecomment",message);
    }catch(Exception ex){
    message=ex.getMessage()+" ->occured with record :"+counter;
    throw new RuntimeException(message);
    }
    counter++;
    return true;
    }
    }
    </attr>
    </Node>

    ja
  • Avatar
    mzatopek
    0
    Comment actions Permalink
    Maybe you are searching for our Universal data reader, check out 'quotedStrings' attribute in the documentation.

    Martin Zatopek
  • Avatar
    mukunku
    0
    Comment actions Permalink
    I find it disappointing that the Flat File Reader can't read a RFC 4180 compliant CSV. The reader requires commas to be quoted themselves where as the standard recommends enclosing the entire string in quotes.
  • Avatar
    Vladimir Barton
    0
    Comment actions Permalink
    Hi Mukunku,
    I have noticed your post concerning this topic and it appears that this thread is more than 10 years old. The good news is that Clover has evolved since then and the functionality that handles RFC 4180 compliant CSV files is now there. Feel free to review the attached example graph as a demonstration of how this can be approached. Worth noting is that FlatFileReader is capable of extracting the metadata automatically with no additional manual changes needed. Hope this helps.
    Kind regards,

Please sign in to leave a comment.