DataItemSeparator---No blank between two dataitem

OnewayOneway Member Posts: 53
Hi all,

How can I import a Sales Order (Sales Header, sales Lines) using dataport? For text file, there is no blank line between header and line.
looks like below

H H1 H2 H3
header
L L1 L2 L3
line
L L4 L5 L6
line

thanks in advance.

Comments

  • idiotidiot Member Posts: 651
    The conventional way is to import all Sales Header 1st followed by all Sales Lines.
    NAV - Norton Anti Virus

    ERP Consultant (not just Navision) & Navision challenger
  • BeliasBelias Member Posts: 2,998
    in your txt file there shold be a record identifier e.g.: lines that begin with 'H' are headers and lines that begin with 'L' are lines...
    you will surely have to write some code in order to place the values in the right tables.
    If I don't understood your problem...tell me if something's missing... :mrgreen:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • SavatageSavatage Member Posts: 7,142
    the dataitem seperator is usually : <<NewLine><NewLine>>

    if this is what you are talking about then view the properties of the blank under the last dataitem to change it
  • OnewayOneway Member Posts: 53
    what i try to do is importing sales order.

    every file contain one sales order (one header and multi-lines).
    The filed separator is tab----this is no problem.

    The problem i met is the DataItemSeparator. On the file, first line is header, from second line are lines. layout as below:

    H H1 H2 H3
    L L1 L2 L3
    L L4 L5 L6

    It is simple to import the data if there is a blank line between header data and line data.

    Unfortunatly, there is no blank line!!! ](*,)

    How can I import them using dataport? :?:
  • SavatageSavatage Member Posts: 7,142
    edited 2008-01-22
    if you hit F1 on the dataitem seperator field it gives you the answer

    :oops:
  • DenSterDenSter Member Posts: 8,305
    The default value is "<<NewLine><NewLine>>", which is one blank line between dataitems. NAV puts the < and the > around default properties, so if you want to set a custom value, you need to remove the outer < and >.

    Try entering "<NewLine>" and try again.
  • OnewayOneway Member Posts: 53
    Come on! have a play please.

    The <NewLine> does not work. The dataport just read one line of the Sales Line Data.
  • SavatageSavatage Member Posts: 7,142
    then it depends on how your datafile is setup..

    Are you specifying a different Line No. for each sales line?
  • OnewayOneway Member Posts: 53
    This is no matter of the line no.

    I created two testing tables. one is header another is line. both of them have three fields, and first field is premiry key.

    then try to import below data. I use <NewLine> as dataitem separator.

    ather imported, in the second table just one line data: "L1 L2 L3"


    H1 H2 H3
    L1 L2 L3
    L4 L5 L6
  • SavatageSavatage Member Posts: 7,142
    You do realize that for the header to be imported you must have
    Specify a "Document Type" & a "No."

    For the Sales Line you must
    Specify a "Document Type", a "Document No." & a "Line No".

    How does your dataport know when the data for the next line is beginning if it's 1 long line..(if I understand correctly)
  • DenSterDenSter Member Posts: 8,305
    Oneway wrote:
    Come on! have a play please.

    The <NewLine> does not work. The dataport just read one line of the Sales Line Data.
    You know that is just borderline rude, a little grace would go a long way, we are all volunteering our time. Would you rather I didn't try to help? :shock:

    The more I think of it the more I think it's not going to work with one header record and an unknown number of line records. You're going to have to import into variables and keep track of the number of records inside the dataport. For the first line you put the values into a Header record, for the second line and on you put the values into line records.
  • OnewayOneway Member Posts: 53
    All right. Thanks guys!
  • OnewayOneway Member Posts: 53
    Sorry to gave a bad example.

    Here is the new example.
    Doc No. Doc Type Sell-to Cust No.
    Doc No. Doc Type Line No. Sell-to Cust No. Type No.
    Below is waht I will receive from the text file:

    SO-1001 Order C00019
    SO-1001 Order 10000 C00019 ITEM IT10002
    SO-1001 Order 20000 C00019 ITEM IT10003
    SO-1001 Order 30000 C00019 ITEM IT10004
    SO-1001 Order 10000 C00019 ITEM IT10002
    ...................................
    ...................................

    Could you please tell me how to import it via dataport? expecially, what the DataItemSeparator should I use? (We just assume no validate needed all data is examed)
  • DenSterDenSter Member Posts: 8,305
    One more time...

    It's not possible to do it with multiple dataitems, because there is nothing specific that separates the two. The reason why one NewLine didn't work is because after the first line record it thought the dataitem was done due to the NewLine.

    You will have to import the fields into variables and program the records yourself.
  • SavatageSavatage Member Posts: 7,142
    Oneway wrote:
    (We just assume no validate needed all data is examed)

    In addition, validation also fills in other fields upon doing so.
    Like when the customer # is entered - there Terms are also inserted, dimensions, amongst other fields. So don't just blow off Validating fields just because the data is correct.

    ps in your example line data 1 & 4 are the same (typo?)
  • OnewayOneway Member Posts: 53
    Thanks all of your for help.
    especially for DenSter :idea:


    I tried several times. You are right. It's no possible to do like that.

    Now I am trying to import like below format.
    SO-1001 Order C00019
    ####
    any characters but not blank line
    SO-1001 Order 10000 C00019 ITEM IT10002
    SO-1001 Order 20000 C00019 ITEM IT10003
    SO-1001 Order 30000 C00019 ITEM IT10004
    SO-1001 Order 40000 C00019 ITEM IT10005


    Is it possible?
  • DenSterDenSter Member Posts: 8,305
    If you have control over the file layout, why not put a blank line in between, so it looks like this:
    SO-1001 Order C00019 
    
    SO-1001 Order 10000 C00019 ITEM IT10002 
    SO-1001 Order 20000 C00019 ITEM IT10003 
    SO-1001 Order 30000 C00019 ITEM IT10004 
    SO-1001 Order 40000 C00019 ITEM IT10005
    
    You've probably already ruled that out, but I had to try :mrgreen:. That way your dataport with two dataitems would work without a problem. Is there a technical reason why you can't put a blank line in there?
  • OnewayOneway Member Posts: 53
    Thanks DenSter,

    unfortunately, the layout is out of my control. The Text file is from 3'd Party mapping provider. They can insert any characters but not blank line .

    This is the core/key problem!!! This is the reason why I looking for help. ](*,)
  • DenSterDenSter Member Posts: 8,305
    I don't see any other way but to import all the fields into variables, and manage the records from there.
  • SavatageSavatage Member Posts: 7,142
    Oneway wrote:
    They can insert any characters but not blank line .

    One of the choices of DataItemSeperator is
    "other Strings" -<The Literal String Entered>

    If this 3rd party place can enter <Next> or whatever as a header for the sales line section you should be ready to go.

    I can't believe they can't add a false header to the lines.
  • DenSterDenSter Member Posts: 8,305
    You could also import everything into one Sales Line dataitem, and create a header record for the first line.
  • SavatageSavatage Member Posts: 7,142
    true!, the sales line contains
    -Order Number
    -Document Type
    -Sell-to Customer No.

    Should be enuf to INSERT into the sales header table using the variables it's being imported into.
    Variables:
    -vDocType
    -vDocNo
    -vCustNo
    OnAfterImportRecord()
    SalesHeader."No." := vDocNo";
    SalesHeader."Document Type" := vDocType;
    SalesHeader."Sell-To Customer No." := vCustNo";
    SalesHeader.INSERT;
    
    SalesLine."Document No." := vDocNo;
    SalesLine."Document Type" :=VDocType;
    SalesLine."Sell-to Customer No." :=vCustNo;
    blah
    blah
    blah
    

    Don't forget to VALIDATE!
Sign In or Register to comment.