Is it possible to export more than 1 record from a table via an XMLport? For example. if I wanted to export a file containing the particulars of a set of sales invoices. Similiarly, if I wanted to export a selection of invoices, how would I tell the XML port which records to pick up? There are some examples of handling multiple records on the install disc regarding imports, but nothing regarding data going out. Thanks
you can find some example in codeunit 8000 that run the XMLPort 8000…8004 e.g. in function SendProdBOMToBN SendProdBOMToBN(ProductBOMHeader : Record “Production BOM Header”) NotificationSetup.GET; IF NOT NotificationSetup.“Send Notifications” THEN EXIT; ProductBOMHeader.SETRECFILTER; ProductBOMXML.SETTABLEVIEW(ProductBOMHeader); ProductBOMXML.“Production BOM Changed”;
XML Rule no. 1 is ‘an XML file must have a single root element…’ When applied to XMLPorts, I think that this means the first tag (the only one allowed to have Indentation = 0) can only occur once. If the first tag has a SourceType of Table, then the table must be filtered to a single record before the XMLPort is run. In the example in Elena’s post, the code line ProductBOMHeader.SETRECFILTER;
has this effect. If you wish to write more than one record from the ‘base’ table (’…a set of sales invoices…’), your XMLPort must begin with a Text Element that, for example, names the collection of records that will follow. To see an example of an XMLPort designed for multiple records, look at XMLPort 10 - IC G/L Account Import/Export. Notice that the first element is a text element that will generate a root element in the xml file named . The second element, based on the IC G/L Account Table, will generate an <ICGLAccount No="…" Name="…" … /> element in the xml file for each record in the file. This XMLPort is run from Form 605 - IC Chart of Accounts, Functions, Export button.
Hi Fritz, Thats exactly the sort of thing I’m after. Thanks for the help. I’ll see how I get on