Processing large XML without an XMLPort in Business Central AL

Ғылым және технология

Thanks to Steve Endow for the data / steveendow
Find more information at my blog www.hougaard.com or follow me on / ehougaard
Source code can be found here: github.com/hougaard/KZread-V...

Пікірлер: 70

  • @MukeshVerma-cc6tw
    @MukeshVerma-cc6tw3 жыл бұрын

    Great Video Erik. Nice to see multiple approaches to import XML data and the impact on the processing time.

  • @everglade160
    @everglade1603 жыл бұрын

    Thanks Erik, Your videos are always very interesting and helpful.

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    My pleasure!

  • @theswayly6171
    @theswayly61713 жыл бұрын

    Very Nice Erik... hope that the next one will be the XmlPort thank you again. Am following you and find your videos very interresting Thanks again

  • 3 жыл бұрын

    Great. And if you open, and close then RecordRef only once, at the beginin and the end of the procedure, it is even faster. Thank you Erik for sharing your knowledge.

  • @thiyagarajanm1063
    @thiyagarajanm10633 жыл бұрын

    Interesting video Erick!!! Thanks👍

  • @Komak4
    @Komak43 жыл бұрын

    Great video! Helped me a lot. Thank you

  • @businesscentral-explained1703
    @businesscentral-explained17033 жыл бұрын

    Very good and helpful video! Thank you so much.

  • @michelchacaliaza787
    @michelchacaliaza787 Жыл бұрын

    Thanks EH, good video 👍

  • @programmer_sujan
    @programmer_sujan8 ай бұрын

    Thanks Erik It helped me lot.

  • @ankurwani9098
    @ankurwani90982 жыл бұрын

    Thank Erik, This will help in my next EDI integration project. That we are Import X12 EDI file into business Central. (X12 Convert XML and XML into BC)

  • @ibrahiemrasoelbaks5124
    @ibrahiemrasoelbaks51243 жыл бұрын

    I really love this one Erik. I'm also interested in processing a more complex/larger Json in BC (Cloud). Thanks once again!

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    Json will come at some point :)

  • @thiyagarajanm1063

    @thiyagarajanm1063

    3 жыл бұрын

    @@Hougaard looking forward for JSON :)

  • @MrSuperAndrey
    @MrSuperAndrey3 жыл бұрын

    XMLNode is an abstract class (cannot be used to create objects, but can have subclasses). An XMLElement is an XMLNode as XMLElement inherits XMLNode (just like a Dog is an Animal for example). So when the argument of a function is for example XMLNode it means that you can provide an XMLElement or something else that inherits XMLNode (Polymorphism)

  • @jonwlong
    @jonwlong Жыл бұрын

    Pretty cool.

  • @vallsjose
    @vallsjose3 жыл бұрын

    I think an element is a specific type of node and there are several types of nodes, anyway awesome video as always Erik!

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    Yeah, the problem become defining "specific" in this case, thanks for watching! :)

  • @nicolassaleron2569

    @nicolassaleron2569

    3 жыл бұрын

    @@Hougaard An element is also called "tag" in HTML, it is the thing between chevrons ( ).

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    @@nicolassaleron2569 It's more than that, from the "tag" perspective, it's the start tag, the end tag and everything in between.

  • @pgupta84

    @pgupta84

    3 жыл бұрын

    @@Hougaard Thank you for the informative video. What is the difference between Element and Attribute in Xml. How do we decide where to use between Element or Attribute while creating an Xml.

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    @@pgupta84 I dislike attributes :)

  • @MrLoualx
    @MrLoualx3 жыл бұрын

    Hi Erik, Great video, thank you :) Can you elaborateon the on 1) The specific performance cost of each method, how and why they differ ? 2) Aswell at the reasoning begin not doing "true validation" ? Keep the videoes coming :)

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    1) When you're working with big data sets, you gotta try out different approaches, some are faster than others, but then you're processing large bulks, even small changes can have a big impact. 2) Just to be faster :)

  • @giovannilimoncello550
    @giovannilimoncello5502 жыл бұрын

    Hi Eric, I'm brand new to Business Central and AL. I love watching your clear & straight forward videos. They helped me to setup my own Cloud sandbox and creating needed tables, list & card pages. Now I have to import a bunch of data from the old system by using your third method. To do so I'm trying to pass the table name into the procedure import(MyTabelName : text). So far that's working, but I can't use it for Data: Record "MyTableName" nor for Ref.Open(DATABASE :: "MyTableName"). Can you please explain how to get this to run or to work around it? Thanks a lot and keep on vlogging

  • @Hougaard

    @Hougaard

    2 жыл бұрын

    Then you need to lookup the table NUMBER for the table name stored in the string variable. (Check the virtual object table AllObj).

  • @johnsonpatrick9318
    @johnsonpatrick9318 Жыл бұрын

    Great video. Do you have any videos made yet to discuss on 'How to Monitor a Azure File Path and import any files from there into Business central SaaS version?', if its already been made, would love to see that as i am working on one such development.

  • @Hougaard

    @Hougaard

    Жыл бұрын

    There's a video on the Azure Blob Storage, named something with ABS ...

  • @bgr49
    @bgr493 жыл бұрын

    Hi Erik, I am trying to read an xml with 3 levels, where the third level has multiple elements, example: How could I read the attribute "field" in the level2 element?

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    Use Attributes() on an XmlElement to get a XmlAttributeCollection. Then read the XmlAttributeCollection to find "field".

  • @bgr49

    @bgr49

    3 жыл бұрын

    @@Hougaard Thank you Erik

  • @matthieucorvaisier5148
    @matthieucorvaisier51482 ай бұрын

    Hi, i'm back in the days :) What's about XMLBuffer record ? Too Slow ? not efficient ?

  • @BlackTigerAP
    @BlackTigerAP3 жыл бұрын

    Use XmlElement's SelectSingleNode/SelectNodes methods.

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    Great suggestion!

  • @chaitanyadeo5076
    @chaitanyadeo50763 жыл бұрын

    Hi Erik, Can you please make a video on Drag & Drop functionality in Business Central. Thanks

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    Drag and drop of what?

  • @chaitanyadeo5076

    @chaitanyadeo5076

    3 жыл бұрын

    @@Hougaard On any card page we can drag & drop any file as an attachment...means we can select any file from location and drop that file on any card page so it will show as an attachment for that card

  • @achimtaeschner7884
    @achimtaeschner78843 жыл бұрын

    Instead of looping through the childElements, you could use SelectSingleNode() on the XmlElement.

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    Certainly, great suggestion, but that's an xpath based parameter, slower to process?

  • @MichaelEgalite
    @MichaelEgalite2 жыл бұрын

    My VS code does not show overloads as in 16:29 Is this some VS add-on?

  • @Hougaard

    @Hougaard

    2 жыл бұрын

    It's standard

  • @stefantomasevic23
    @stefantomasevic233 жыл бұрын

    Hi Erik, what do you think about processing xml files with data exchange framework? Do you use it? You know that in most cases xml files are not that simple.

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    I find the data exchange framework "unnecessary", since you have to write code anyway. Yes, I'm aware that this is a simple XML (the bigger, the simpler) - Imagine long the video would be if it was a complication XML :)

  • @sshadows

    @sshadows

    3 жыл бұрын

    @@Hougaard It is possible to import an XML file via Data Exchange Framework without writing one single line of code.

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    @@sshadows Dunno, I kinda gave up the the Data Exchange Framework a long time ago, maybe I need to check it again :)

  • @sshadows

    @sshadows

    3 жыл бұрын

    @@Hougaard It is mostly used by partners with large corporate customers with their own superusers/admins. As you are targeting SaaS, then that is not the customers you usually meet. We have banks which have their data-guys customizing the datadefs we have made. But again those will never go SaaS.

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    But the Data Exchange still requires programming, you need to create all the supporting codeunits, and make sure they are able to cope with the layout being changed to make it work. That seems like a bigger job that just creating imports/exports?

  • @carstenhansen3979
    @carstenhansen39793 жыл бұрын

    Hi Erik, I think that you forgot to tell that with option 2 and 3 the possibility that you can get into problems if the sequence of xml elements is not 1:1 to you sequence of validates. I often use option 2 or 3 to get data into a temporary table and later option 1 with validates. Moreover you might need temporary tables if you need to handle more tables at the same time. You have for instance - Document Node - Element Node - Attribute Node - Comment Node - xx Nodes (CData and more) See www.w3schools.com/xml/dom_nodes.asp

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    You're completely right, but this video is 42 minutes already. The purpose of the video was to explain that you can use the Xml* native datatypes in AL in several different ways, especially when working with large datasets.

  • @narayanchourey9270
    @narayanchourey9270 Жыл бұрын

    Hi Erik, How to create Namespaces in XML files? Thanks in Advance☺

  • @blutkraehe_official
    @blutkraehe_official3 жыл бұрын

    hi, my xml is so: ...Data... i need the LINE how do i define the XmlDoc.GetRoot(Root); ? and then the Records := Root.GetChildElements('LINE'); ?

  • @KuljeetParmar
    @KuljeetParmar2 жыл бұрын

    I am trying to send customer data from one BC company to another BC company on different tenants using webservices . i am thinking if possible to store table data in XMLDoc and then convert XMLDoc to text , pass the text as body for the API post call which will point towards the BC codeunit webservice with a text parameter and then extract xml from the text in destination company . Is it a good solution ? thanks

  • @Hougaard

    @Hougaard

    2 жыл бұрын

    Here's a commercial solution: www.hougaard.com/bccl

  • @spidione1
    @spidione13 жыл бұрын

    This will do the job, but I find using XMLport method a solution much more cleaner. Or doing .Net serialization .

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    DotNet is not an option with Business Central in the cloud.

  • @blutkraehe_official
    @blutkraehe_official3 жыл бұрын

    i want the child node under the root, please help!!

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    Root as a XmlElement, then .GetChildElements

  • @extensionsforce8184
    @extensionsforce81843 жыл бұрын

    A very slow method. In a real big XML document (200mb-2GB) it will end right here XmlDocument.ReadFrom(InS, XmlDoc)

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    Then your only options are either a custom parser or try using XMLPorts. The next problem is how to get a XML over 350MB to Business Central in the first place.

  • @BlackTigerAP

    @BlackTigerAP

    3 жыл бұрын

    XML is not designed for such volumes. Originally it was designed only for small "messages" to pass information between computers. If you're facing such big "XML databases" then your solution design is wrong. Also there a huge inefficiency of XML - up to 90% of file is just a tag names, not the actual data. It's more efficient to use detached SQL database file instead of huge text file which is worse then old-skool CVS.

  • @Hougaard

    @Hougaard

    3 жыл бұрын

    And that's a high horse :)

Келесі