XMLPort inserting multiple levels to Sales Invoice where file has data missing on some lower levels

Creating an XMLPort to import Sales Invoice data from an external system.

Sales Header, Sales Lines are ok, but there is an additional level for details, which would normally be entered as text Description line below the relevant Sales Line.

The import file doesn't have details for that additional level for all the sales lines being imported, it only appears on some records.

With the 3 level (or possibly more) import files, how do you tell it to skip the checking for level 3, if there is no data for that level under one of the level 2 lines?
Currently my import is stopping with the error that the import file doesn't fit the schema.
Thanks

Debbie

Best Answer

  • vaprogvaprog Member Posts: 1,140
    Answer ✓
    Hi,

    You import file is XML? Set the base element for level 3 (or for all relevant elements, if more than one) to optional (i.e. property MinOccurs=Zero)

Answers

  • vaprogvaprog Member Posts: 1,140
    Answer ✓
    Hi,

    You import file is XML? Set the base element for level 3 (or for all relevant elements, if more than one) to optional (i.e. property MinOccurs=Zero)
  • RockWithNAVRockWithNAV Member Posts: 1,139
    Hey dsummer,

    First of all you need to make the same XML port as you are getting from the external system as NAV will exactly map with one to one relationship while doing the import process. Schema should always be static if you are using a common XMLPORT. Secondly if you have some Fields which ou have attached in the XMLPORT and they may come blank then you need to convert those Field as Text type instead of Fields and write Below code on the Import::OnAfterAssignField Trigger.

    ItemstoShip TEXT

    IF ItemstoShip = '' THEN
    Table."Items to Ship" := 0
    ELSE
    EVALUATE(Table."Items to Ship",ItemstoShip);

  • dsummerdsummer Member Posts: 7
    Thank you. The MinOccurs=Zero is doing the trick.
    Thanks

    Debbie
  • dsummerdsummer Member Posts: 7
    I'm down to the final section in the import file, which is the Description lines at the bottom of the file to be inserted as extra lines in the Sales Document. The code behind the sections isn't being recognized. Are you able to help with this question too?
    http://forum.mibuso.com/discussion/66253/xmlport-2009-how-to-insert-sales-line-description-lines-from-xml-file-lines?new=1
    Thanks

    Debbie
Sign In or Register to comment.