LAE

 View Only
  • 1.  Delimited node to skip first line/ use row 2 as header

    Employee
    Posted 11-13-2017 03:42

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: benhui12

    I have a delimited file that looks like the following:

    ABC Report as of |01/01/2017| ColA;ColB;ColC;ColD DataA;DataB;DataC;DataD DataA;DataB;DataC;DataD

    I am currently manually deleting the first row (the ABC Report row) so it can be loaded and delimited in the delimited node. Is it possible to specify the header row like excel input node?
    Thanks!


  • 2.  RE: Delimited node to skip first line/ use row 2 as header

    Employee
    Posted 04-16-2019 14:10

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: sgerbig700

    did you ever get an answer to this? I have a similar problem.


  • 3.  RE: Delimited node to skip first line/ use row 2 as header

    Employee
    Posted 04-16-2019 14:43

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: gmullin

    Are your field names consistent? If so enter them in the FieldNames parameter on the Optional tab, then add a Filter node directly after the Delimited node using "where execCount > 2" so you can skip the first 2 rows.

    If your field names are not consistent you can use Input Raw to read the file, discard the first row and overwrite the file with a clean one. It will do the same as you manually opening the file and deleting the first row.

    Sample file data, save this to a text file:

    			
    				Remove this row
    Col1,Col2,Col3
    a,b,c

    Sample graph with FileName graph parameter:

    node:Input_Raw
    bretype:lal1::Input Raw
    editor:sortkey=5cb6492d2e9e7d32
    output:@51ae0881326a4c48/=
    prop:File={{^FileName^}}
    editor:XY=200,260
    end:Input_Raw
    
    node:Discard_first_row
    bretype:core::Filter
    editor:Label=Discard first row
    editor:sortkey=5cb649e4755d6614
    input:@40fd2c74167f1ca2/=Input_Raw.51ae0881326a4c48
    output:@40fd2c7420761db6/=
    prop:Script=<<EOX
    splitRaw = '_RawData'.split("\n")
    i = 1
    
    while i < splitRaw.len() {
    	if i == 1 then 
    		newData = str(splitRaw[i])
    	else 
    		newData = newData + "\n" + str(splitRaw[i])
    	i = i + 1
    }
    
    
    emit newData
    
    EOX
    editor:XY=310,260
    end:Discard_first_row
    
    node:Overwrite_file
    bretype:lal1::Output Raw
    editor:Label=Overwrite file
    editor:sortkey=5cb64abf4f421de5
    input:@5106ebc83f035045/=Discard_first_row.40fd2c7420761db6
    output:@4ffae39e126d75ee/=
    prop:DataField=newData
    prop:File={{^FileName^}}
    prop:FileExistsBehavior=Overwrite
    prop:FileParamType=Literal
    editor:XY=440,260
    end:Overwrite_file
    
    node:Delimited_File_3
    bretype:core::Delimited File
    editor:sortkey=5cb64b131adb762d
    input:5cb64b130a164414/=Overwrite_file.4ffae39e126d75ee
    output:@41e6c6cd11e613c6/=
    prop:FieldDelimiter=,
    prop:FilenameExpr=<<EOX
    '_Filename'
    EOX
    prop:RecordDelimiter=\n
    editor:XY=570,260
    end:Delimited_File_3


  • 4.  RE: Delimited node to skip first line/ use row 2 as header

    Employee
    Posted 04-16-2019 15:16

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: sgerbig700

    Thank you. Saved a whole bunch of time NOT using the split & get functions!!