Skip to main content

Notifications

Microsoft Dynamics NAV (Archived)

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

Posted on by Microsoft Employee

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

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: XMLport how to check value if exist in the table befor insert record

    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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: XMLport how to check value if exist in the table befor insert record

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: XMLport how to check value if exist in the table befor insert record

    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. 

  • Suggested answer
    RockwithNav Profile Picture
    RockwithNav 6,562 on at
    RE: XMLport how to check value if exist in the table befor insert record

    Hey,

    Import::OnBeforeInsertRecord'

    Writing code on this trigger will too solve your case. 

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,135 Super User 2024 Season 2 on at
    RE: XMLport how to check value if exist in the table befor insert record

    also set AutoUpdate to Yes.

  • Suggested answer
    RobertasR Profile Picture
    RobertasR 5,002 on at
    RE: XMLport how to check value if exist in the table befor insert record

    Hi,

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

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

    Robertas

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: XMLport how to check value if exist in the table befor insert record

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

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,135 Super User 2024 Season 2 on at
    RE: XMLport how to check value if exist in the table befor insert record

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: XMLport how to check value if exist in the table befor insert record

    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
    Mohana Yadav 59,135 Super User 2024 Season 2 on at
    RE: XMLport how to check value if exist in the table befor insert record

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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans