Skip to main content

Notifications

Announcements

No record found.

Business Central forum

Filter data before XMLPort.Export()

Posted on by 525

Hi 
I want to export XMLPort's data into a text variable after applying some filters. Currently I have this:

procedure GetJobTasksList(): Text
var
JobTask : Record "Job Task"; tempBlob: record TempBlob; IStream: InStream; Ostream: OutStream; StreamText: text;
JTXmlport: Xmlport 50000; begin TempBlob.Blob.CreateOutStream(Ostream);
//JobTask.Setfilter(/*filters*/)
//JTXmlPort.SetTableView(JobTask) Xmlport.Export(50000, Ostream); tempblob.blob.CreateInStream(IStream); tempblob.CalcFields(blob); StreamText := Base64Convert.StreamToBase64String(IStream); exit(StreamText); end;
If I use SetTableView on XMLPort variable (JTXmlPort) and then Use the Xmlport.Export() function it doesn't work and that makes sense. I need to be able to find a way so that I can export the data to a text variable but it should be filtered.
Categories:
  • Suggested answer
    Mohsin Abbas Profile Picture
    Mohsin Abbas 525 on at
    RE: Filter data before XMLPort.Export()

    After a bit of searching I got to know that I was ignoring an optional parameter of the xmlport.Export() function. After applying filters on JobTask record, it can be sent as a parameter like this:

    JobTask.Setfilter(/*filters*/)

    JobTask.Findset;

    Xmlport.Export(50000, Ostream,JobTask);

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans