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)

XMLport how to check value if exist in the table befor insert record

(0) ShareShare
ReportReport
Posted on by

Hi all,

i'am trying to start coding my own XMLport and i need to know how to check the value before the insert in the table for exemple :

the table contain item 1 and item 2 with price P1 and P2 I use an XMLport to upgrade prices but my file containe item 1 and new price NP1 and item 3 and new price NP3 so my database doesn't have item3 i want the XMLport to update only Item1 and ignor the item 3 

how can i do it ? 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at

    check the properties of Item dataitem in xmlport and set AutoSave to No.

  • Community Member Profile Picture
    on at

    this will stop the xmlport from importing the data automatically and i need a code to check if the value exist and import it.

  • Suggested answer
    Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at

    it will not import if data is not not available in table. no need to write code to check.

  • Community Member Profile Picture
    on at

    i just try this and now it doesn't update the prices

  • Suggested answer
    RobertasR Profile Picture
    5,004 on at

    Hi,

    could you try on the 'Import::OnBeforeInsertRecord' trigger putting something like this:

    If NOT Item.GET(ItemNo) THEN CurrXMLPort.SKIP;

    Robertas

  • Suggested answer
    Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at

    also set AutoUpdate to Yes.

  • Suggested answer
    RockwithNav Profile Picture
    8,600 Super User 2025 Season 2 on at

    Hey,

    Import::OnBeforeInsertRecord'

    Writing code on this trigger will too solve your case. 

  • Community Member Profile Picture
    on at

    yes AutoUpdate is to yes but doesn't update

    also in the dynamic nav walkthrough (msdn.microsoft.com/.../dd338609(v=nav.90).aspxx) they say "If AutoSave is set to No, then an imported record is not automatically written to the appropriate table. To insert or modify records manually, add code to the OnBeforeInsertRecord Trigger and the OnBeforeModifyRecord Trigger." i need just example for insert records from xmlport manyally. 

  • Community Member Profile Picture
    on at

    RockWith NAV  do you have some samples of code that insert the records on table ?

  • Verified answer
    Community Member Profile Picture
    on at

    i add this code

    IF Item.FIND('-') THEN BEGIN

       currXMLport.SKIP; END

    in the OnBeforeInsertRecord() trigger and set the AutoSave to Yes it worked for me

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