Read entire line during OnbeforeImportRec from dataport

tompynationtompynation Member Posts: 398
Is it possible to read an entire line from a csv file, instead of each record separtly?

I would like to have a string inside my OnBeforeImportRecord method
which contains the line from my csv file which is being read currently.

Comments

  • bbrownbbrown Member Posts: 3,268
    Note: The record is read during the OnAfterImportRecord trigger

    Create a text variable (max length 1024) and import the entire record to the variable. Then parse it in code.

    You may run into issues if the records are not even length. You might be better of writing a codeunit and using the C/Side file commands
    There are no bugs - only undocumented features.
  • tompynationtompynation Member Posts: 398
    how do i import the entire record to my text var?
  • bbrownbbrown Member Posts: 3,268
    Specify your VAR as a dataport field
    There are no bugs - only undocumented features.
  • tompynationtompynation Member Posts: 398
    that is not working... am i doing something wrong?

    I created a C/AL global variable:

    Name DataType Subtype Length
    volleRegel Dataport Import Prices

    When i then try to display the var:


    Message('Volle Regel: ' + FORMAT(volleRegel));

    IF "Item No." = '' THEN BEGIN
    itemCrossRefRec.SETRANGE("Cross-Reference Type No.", '10000');
    itemCrossRefRec.SETRANGE("Cross-Reference No.", '20-587');
    IF itemCrossRefRec.FIND('-') THEN BEGIN
    "Item No." := itemCrossRefRec."Item No.";
    END;
    END;

    I get the message: Volle Regel: In Use ](*,)
  • bbrownbbrown Member Posts: 3,268
    Specify the global var as type TEXT 1024. The add it to the Dataport fields list. (Only item in list).
    There are no bugs - only undocumented features.
Sign In or Register to comment.