web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)
Suggested Answer

How to import a new file using XML port in nav classic client.

(0) ShareShare
ReportReport
Posted on by 475

I have created a XML port with sales header as a parent and sales line as a child  and i want to import some data  to it .But when i do this the empty records in the sales order must be skipped and move on  to the next record .

For Ex.

In sales header I have a field called alternate number and i want skip the header which does not contain alternate number and the correspnding lines must also be skipped and the next record must be imported.

Please help...

Thanks in advance..

*This post is locked for comments

I have the same question (0)
  • Hannes Holst Profile Picture
    5,767 on at
    IF "Alternate Number" = '' THEN
      CurrXMLport.SKIP;

    Add the above in the OnBeforeInsertRecord-trigger of the parent dataitem (Sales Header).

    https://docs.microsoft.com/en-us/dynamics-nav/skip-function--report--xmlport-

    https://docs.microsoft.com/en-us/dynamics-nav/developer/triggers/devenv-onbeforeinsertrecord-trigger

  • bharathkarunakaran Profile Picture
    475 on at

    Thanks hannes holst for your answer I will check with that

  • bharathkarunakaran Profile Picture
    475 on at

    2018_2D00_02_2D00_01-16_5F00_42_5F00_35_2D00_CRONUS-USA_2C00_-Inc.-_2D00_-Microsoft-Dynamics-NAV-Classic-_2D00_-_5B00_Vehicletable-_2D00_-Table_5D00_.png2018_2D00_02_2D00_01-16_5F00_41_5F00_08_2D00_CRONUS-USA_2C00_-Inc.-_2D00_-Microsoft-Dynamics-NAV-Classic-_2D00_-_5B00_XMLport-56661-vEHICLExml-_2D00_--_2D00_-Copy.png2018_2D00_02_2D00_01-16_5F00_41_5F00_32_2D00_CRONUS-USA_2C00_-Inc.-_2D00_-Microsoft-Dynamics-NAV-Classic-_2D00_-_5B00_Codeunit-55551-vehiCode-_2D00_-C.png2018_2D00_02_2D00_01-16_5F00_42_5F00_35_2D00_CRONUS-USA_2C00_-Inc.-_2D00_-Microsoft-Dynamics-NAV-Classic-_2D00_-_5B00_Vehicletable-_2D00_-Table_5D00_.pngThanks for the reply.

    I have this much so far now i am able to import but i am unable to skip a particular data .I tried using your code by using it in XML port but it doesn't work

    Ex.In the above notepad file when something data(ex.model or line no)is missing then the complete detail about that vehicle must be skipped and it should pass on to the next data present in the notepad file.

    please advice...

    Thanks in advance

    In Xml port on the onafter get record trigger 

    IF Vehicle.Mode ='' THEN

    CurrXMLPort.Skip;

    but this not working for me .

    Its skip all records and only empty records are transffered to the tables,Can anyone suggest me how skip the error while import and pass to next value in the table.

    Any help would be appreciate.

    Thanks 

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    You need add the code in OnBeforeInsertRecord Trigger.

  • bharathkarunakaran Profile Picture
    475 on at

    Hi Skulla

     I have tried this but it doesn't seems to work . Is there any other way to work around for this issue.

  • bharathkarunakaran Profile Picture
    475 on at

    Screen_5F00_Shots.zip

    Hi

    I tried to add a new code unit which will delete the multiple lines while importing the XML data and I called that codeunit in the corressponding codeunit which is used to import the data .But it doesn't  seems work for me.

    Have anybody done this before ..Can anyone suggest me some ideas

    Warm regards,

    Bharath

  • bharathkarunakaran Profile Picture
    475 on at

    I attached the screenshots file above...

  • Hannes Holst Profile Picture
    5,767 on at

    hi,

    See attached. Works a treat.

    Not sure which version you are on. You are able to call XMLports directly.
    Check the other parts of your code.

    6131.Untitled2.png

    6131.Untitled2.png

    0755.Untitled.png

    [View:/cfs-file/__key/communityserver-discussions-components-files/34/XMLport-Skip-Test.zip]

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    It should work, what line of code did you add OnBeforeInsertRecord trigger?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans