Options

Dataport using two dataitems

shwetashweta Member Posts: 94
I am using two data items sales invoice header and sales invoice line when i indent sales invoice line and give the linking It is giving an error.
how I can do it
ITS URGENT

Comments

  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    I don't know what to do if you don't post your error message.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    garakgarak Member Posts: 3,263
    edited 2008-08-14
    Linking in Dataports are only for UPXML format (<4.03).
    Take a look in OnlineHelp (C/SIDE Reference Guide)

    Regards
    Do you make it right, it works too!
  • Options
    JedrzejTJedrzejT Member Posts: 267
    This is message about..if you want to use indenting then choose FileFormat - UpXml.
    This is old message - in Nav 5/4Sp3 you can't even select this type of fileformat in property. XmlPort is designed for that.
  • Options
    shwetashweta Member Posts: 94
    I don't know what to do if you don't post your error message.

    "you have indented data items but the file format is not UPXML for more information see the C/SIDE reference guide."

    this error i got
  • Options
    garakgarak Member Posts: 3,263
    if you need to export a datastructure, use XMLPORT.

    Regards
    Do you make it right, it works too!
  • Options
    SavatageSavatage Member Posts: 7,142
    are you trying to import or export or both? It can be done without linking them too.
  • Options
    einsTeIn.NETeinsTeIn.NET Member Posts: 1,050
    shweta wrote:
    I don't know what to do if you don't post your error message.

    "you have indented data items but the file format is not UPXML for more information see the C/SIDE reference guide."

    this error i got
    Sorry, I didn't see that you want to intend sales invoice line. The answer is already given by the other posters.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • Options
    vijay_gvijay_g Member Posts: 884
    Savatage wrote:
    are you trying to import or export or both? It can be done without linking them too.

    How it is possible?
  • Options
    afarrafarr Member Posts: 287
    I think he just meant that you can have two different data items in a dataport (e.g. for Sales Header and Sales Line), but without indentation, and without any link between them.

    So you can use filters to export only some specific Sales Headers, but (without coding) there’s no way to get just the Sales Lines for those headers.
    For example, you can export all Sales Headers with Status = Open, but (without coding) you can’t export just the Sales Lines for open Sales Headers.

    One way to set up such a link is with a temporary Sales Header table. Insert a record for each Sales Header that you export; then when exporting Sales Lines, check that there is a record in the temp table with the same Document Type and Document No.
    Alastair Farrugia
  • Options
    vijay_gvijay_g Member Posts: 884
    thanks a lot,
    but i want data in form of like.

    sales header doc1
    sales line doc1 line 1
    doc1 line 2

    sales header doc2
    sales line doc2 line 1
    doc2 line 2

    i think that's can only possible with indent.
  • Options
    afarrafarr Member Posts: 287
    Yes, that would require indentation.

    This is not supported in dataports, because dataports export only the field values, without explicitly saying which table the data is from.
    Alastair Farrugia
  • Options
    rsaritzkyrsaritzky Member Posts: 469
    vijay_g wrote:
    thanks a lot,
    but i want data in form of like.

    sales header doc1
    sales line doc1 line 1
    doc1 line 2

    sales header doc2
    sales line doc2 line 1
    doc2 line 2

    i think that's can only possible with indent.

    There is another way to do this without indentation which I've used in importing data from external sources, where the file is in header/line/line, header/line/line format. It requires some extra coding, and depends on whether you can tell from a specific field whether an input line is a header or a line item. Here's the basic flow:

    1. Use the Integer table as your data item.
    2. You have to set up your dataport to input all fields as text. Create fields F1, F2, F3, F4, etc. all as text fields, making them as long as the longest possible value.
    3. Now, look at the field that tells you if it's a header or a line. As an example, let's say that the first field F1 has a value of HDR if it is a header and LIN if it is a line item. In your code, you have
    IF F1 = HDR THEN
    CreateSalesHeader
    ELSE
    CreateSalesLine

    4. Now build 2 functions "CreateSalesHeader" and "CreateSalesLine", converting fields to numeric or date if necessary. Here's a short boilerplate for Header

    SalesHeader.INIT;
    SalesHeader."Document Type" := SalesHeader."Document Type"::Order;
    SalesHeader."No." := F2; // Assuming field 2 is order number. You can also assign an order number by calling the appropriate No. Series commands
    SalesHeader.VALIDATE("Sell-to Customer No.", F3); // Assuming field 3 is customer No.
    SalesHeader.VALIDATE("Posting Date", DMY2DATE(COPYSTR(F4,4,2), COPYSTR(F4,1,2),COPYSTR(F4,7,4)); // Assuming field 3 is date in format MM/DD/YYYY
    ... etc.
    SalesHeader.INSERT;


    Numeric fields like Price or Quantity in the input file should be stored without commas or currency signs, or otherwise they will have to be stripped out in your code. If it is a straight numeric, then you can use the EVALUATE function, e.g.

    OK := SalesLine.EVALUATE("Quantity", F11);

    Hope this gives you some ideas...
    Ron
  • Options
    vijay_gvijay_g Member Posts: 884
    thank you very much....
    looking typical but i have to try with this procedure.

    again thanx
  • Options
    mickysoftmickysoft Member Posts: 4
    you can use a temporary table in the fisrt dataitem to insert all the filtered records then in the next dataitem on the beforeexport trigger use a conditional ie. if not tableTMP.get(....) then skip;
Sign In or Register to comment.