XMLPort: Import Into Temporary Table

08 Aug

Earlier today I wrote a blog post XMLPort: Export from temporary tables. The principle is the same when you want to import to a temporary table. Instead of calling a function in XMLPort before you call the export that inserts values into the temporary table you do the opposite, call a function after the import has completed that copies all the temporary data to your temporary record parameter.  Create the XMLPort in the same way and don’t forget to mark the table as temporary.

Temporary Property on XMLPort

Create a function in the XMLPort that fetches the imported data and copies it to the parameter.

    PROCEDURE GetTemporaryRecord@1000000002(VAR TemporaryItem@1000000000 : Record 27);
      //Copy all the temporary records to the new temporary variable
        TemporaryItem := Item;
      UNTIL Item.NEXT = 0;

Here is the test function that I use to call the XMLPort.

PROCEDURE ImportXMLToTempRecords@1000000013();
      TemporaryItemXMLPort@1000000003 : XMLport 69782;
      TempItem@1000000004 : TEMPORARY Record 27;
      TestFile@1000000002 : File;
      Instream@1000000001 : InStream;
      FileName@1000000000 : Text[100];
      //Builds data in temporary records and uses a XMLport with the temporary property to export the
      //temporary records as XML

      FileName := 'C:\temp\TESTXML.txt';

      IF TempItem.FINDSET THEN
        MESSAGE('Found the imported records, count=%1',TempItem.count)
        ERROR('Couldn't find the imported records');

Here is the XML that I’m importing (export from my previous blog post)

<?xml version="1.0" encoding="UTF-16" standalone="no"?>
1 Comment

Posted by on 2015-08-08 in Okategoriserade


Tags: , , ,

One response to “XMLPort: Import Into Temporary Table

  1. Brian Blackstone

    2015-09-08 at 06:26

    YES! This is exactly what I’ve been looking for! I missed it because of the simplicity! I couldn’t figure out how to get the temporary table data back from the XMLPort import, without writing it to a real table first. Creating a GetTemporaryData function fixes that. Thank you so much!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

David Worthington's NAV Performance Blog

Micosoft Dynamics NAV Performance Testing & Optimization

Freddys Blog

Reflections from the ERP field

Mark Brummel Blog | Microsoft Dynamics NAV

Master Classes Design Patterns and more...

ideas in the cloud

Goprowe AB

Reflections from the ERP field

ArcherPoint Developer Blog

Reflections from the ERP field

The NAV Viking´s Blog

- Sharing my experience in the Dynamics NAV world

Comments for waldo's blog

Reflections from the ERP field

Nav Can Be Fun

Its Really Fun to Work with Microsoft Dynamics Nav / D365 Business Central


Reflections from the ERP field


Tips, Tricks, How-To's & News about Microsoft Dynamics NAV & Dynamics 365 for Financials

Kine's Info

Reflections from the ERP field

Just another site

NAV/SQL Performance - My Two Cents

Reflections from the ERP field – Applied Hacking

Reflections from the ERP field

Kauffmann @ Dynamics 365 Business Central

Reflections from the ERP field

Kriki’s Dynamics NAV blog

Reflections from the ERP field

Rashed Amini

Reflections from the ERP field

Olof Simren - Microsoft Dynamics NAV & 365 Business Central Blog

My blog about Microsoft Dynamic NAV & 365 Business Central tips and tricks. Remember to Subscribe!

%d bloggers like this: