Avoid First Line of Import

HT3

ProgressTalk.com Sponsor
Hi All,

I'm looking to run a script on a regular basis which imports data from another file.

The first line of the import file contains headers and needs to be avoided, the attached error always appears.

I just don't want the error appearing every time I ran it or I don't want to delete the headers from the file each time it's run.

Code:
DEFINE VARIABLE cInputFile AS CHARACTER.
DEFINE VARIABLE cOutputFile AS CHARACTER.
DEFINE VARIABLE iOrder AS INTE.
DEFINE VARIABLE cWebOrdNum AS CHAR FORMAT "x(12)".

ASSIGN cInputFile = "\HybrisOrdMerge\Orders-From-Inc.csv"
       cOutPutFile = "\HybrisOrdMerge\Both-B2B-Orders-Created-In-Hybris.csv".

DEFINE STREAM sInput.
DEFINE STREAM sOutput.

INPUT STREAM sInput FROM VALUE (cInputFile).
OUTPUT STREAM sOutput TO VALUE (cOutPutFile).

DEFINE TEMP-TABLE tt-Orders
FIELD IncOrdNum AS INTE
FIELD IncWebOrdNum AS CHAR
FIELD ELOrdNum AS INTE
FIELD ELWebOrdNum AS CHAR
INDEX tt-Orders IS PRIMARY UNIQUE IncOrdNum.

REPEAT:                                                                                                                            

    IMPORT STREAM sInput DELIMITER "," iOrder cWebOrdNum.

    CREATE tt-orders.
    ASSIGN tt-orders.IncOrdNum = iOrder.
    ASSIGN tt-orders.IncWebOrdNum = cWebOrdNum.
                                                           
END.
                                
INPUT STREAM sInput CLOSE.

FOR EACH tt-orders WHERE NO-LOCK:

Thanks,
Hassam
 

Attachments

  • Import Error.png
    Import Error.png
    9.5 KB · Views: 9
  • Headers.png
    Headers.png
    19.1 KB · Views: 9
Add a line like the below before before the REPEAT block . That imports a line and the caret means the field is skipped.

Code:
IMPORT STREAM sInput UNFORMATTED ^.
 
Back
Top