Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

XMLPort, Manage Error, Skip record and continue

(0) ShareShare
ReportReport
Posted on by 1,707

Hi,

I have created my custom XMLport for import the CSV file, In XMLPort, when I import data from external csv file it will import record. but when error occurs in record it will not import any data. I want to skip those record and continue importing. anyone have a soution for this?

Thank you.

  • Inkey Solutions Profile Picture
    Inkey Solutions 1,707 on at
    RE: XMLPort, Manage Error, Skip record and continue

    Thank you sir for your reply,

    Can you provide me the screenshot of your steps or where can i find "Properties Window" in AL object Designer(designer).

  • Inkey Solutions Profile Picture
    Inkey Solutions 1,707 on at
    RE: XMLPort, Manage Error, Skip record and continue

    Thank you sir for your reply,

    I have created XMLPort of tableelement "Item", & Added action of XMLPort on "Item" Page but

    It's not working, I have also attched the screenshot of my code. Can you please check it?

    PageExtension.png                 

                  8507.XMLPort.png

  • Suggested answer
    Shawnsauve Profile Picture
    Shawnsauve 1,089 on at
    RE: XMLPort, Manage Error, Skip record and continue

    Yes, you can handle errors in XMLPort during the import process by using Error Handling Properties.

    To skip the record with errors and continue importing the rest of the data, you can set the ErrorHandling property to "Skip". This will allow the XMLPort to continue importing data even if it encounters errors in some records.

    Here are the steps to set the ErrorHandling property to "Skip":

    1. Open the XMLPort in the designer.

    2. In the Properties window, locate the ErrorHandling property and set it to "Skip".

    3. Save and compile the XMLPort.

    4. Run the XMLPort to import the CSV file. When an error occurs in a record, the XMLPort will skip that record and continue importing the rest of the data.

    Note that when using the "Skip" option, the XMLPort will not report any errors for the skipped records. If you want to track the errors and their corresponding records, you can set the ErrorHandling property to "Stop". This will stop the import process when an error occurs and display an error message with the details of the record causing the error.

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 74,115 Super User 2024 Season 2 on at
    RE: XMLPort, Manage Error, Skip record and continue

    Hi, If you want to skip a certain line, you can try the following method.

       

    Xmlport.Skip() Method - Business Central | Microsoft Learn

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    DAnny3211 Profile Picture
    DAnny3211 9,272 Super User 2024 Season 1 on at
    RE: XMLPort, Manage Error, Skip record and continue

    Hi

    You should run the xml on a dataitem of type integer:

    you have to create a function of type [TRY] where you run the checks in which you enter any errors, that way the xml port will continue to run to the end

    check my answer if it helped you, thanks

    DAniele

  • Inkey Solutions Profile Picture
    Inkey Solutions 1,707 on at
    RE: XMLPort, Manage Error, Skip record and continue

    Thank you for the prompt reply, but

    I have already imported Record From external CSV or XML file,

    But when error occurs in any one field Record (just like, code datatype length is code[20] and we gave length more than 20 in external file Records),

    It will gave the error and not import any record of external file, not only those Record whole records are not imported, i want to skip only one record and continue importing other records.

  • Suggested answer
    Nitin Verma Profile Picture
    Nitin Verma 21,091 Super User 2024 Season 1 on at
    RE: XMLPort, Manage Error, Skip record and continue

    Hi,

    You can try with the below video link

    www.youtube.com/watch

  • Inkey Solutions Profile Picture
    Inkey Solutions 1,707 on at
    RE: XMLPort, Manage Error, Skip record and continue

    Thank you Mohana, But I am Newbie in this area, could you please sent me the any reference link or blog if you have, it would be really helpful to me.

    Thank you once again for the prompt reply.

  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,194 Super User 2024 Season 2 on at
    RE: XMLPort, Manage Error, Skip record and continue

    Create a buffer table and import the records to that table first and then process the data to main tables.

    You can add a validation function before moving the records to main table and skip them if there is any error.

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!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans