Skip to main content
Post a question

Notifications

Community site session details

Community site session details

Session Id : NLtUikHPObEJLeObmslj6B
Small and medium business | Business Central, N...
Answered

XMLPort Problem Filtering table - .CSV output

Like (0) ShareShare
ReportReport
Posted on 4 Sep 2020 16:24:09 by 47

I have an XMLPort that I have created and I cannot get the table to filter correctly. I have used the SETFILTER variable to only list out ‘Released’ Production Orders. This is on the line as all the info I need is on the line. I am filtering for 'Released' only in SETFILTER. When I do this on the table in the DEV environment It filters correctly. When I run the XMLPort I get what I want except for the first line. I cannot figure out why it is doing this.

Thank you in advance for any help

TroySETFILTER-Image.png

Result-of-XMLPort.png

  • troyh1968 Profile Picture
    47 on 07 Oct 2020 at 20:28:41
    RE: XMLPort Problem Filtering table - .CSV output

    Sorry for the delayed response.

    Setting it on the table data worked.

    Thank you

  • troyh1968 Profile Picture
    47 on 07 Oct 2020 at 20:27:17
    RE: XMLPort Problem Filtering table - .CSV output

    Sorry for the delayed response. This worked!

    Thank you

  • Verified answer
    Bodhi Profile Picture
    558 on 15 Sep 2020 at 06:31:33
    RE: XMLPort Problem Filtering table - .CSV output

    Prod. Order Line - Export::OnPreXMLItem()

    "Prod. Order Line".SETFILTER("Prod. Order Line".Status,'%1',"Prod. Order Line".Status::Released);

    or

    "Prod. Order Line".SETRANGE(Status,"Prod. Order Line".Status::Released);

  • Bodhi Profile Picture
    558 on 15 Sep 2020 at 06:30:48
    RE: XMLPort Problem Filtering table - .CSV output

    1, we should put the filter under Export::OnPreXMLItem()

    2, Syntax:

    "Prod. Order Line".SETFILTER("Prod. Order Line".Status,'%1',"Prod. Order Line".Status::Released);

    or

    "Prod. Order Line".SETRANGE(Status,"Prod. Order Line".Status::Released);

  • troyh1968 Profile Picture
    47 on 04 Sep 2020 at 19:31:51
    RE: XMLPort Problem Filtering table - .CSV output

    Josh Thank you for the help. I tried both options you gave and neither worked. I am still getting the same result 1 record that the filters should remove.

    A little more background on this XMLPort. It is going to be automated with a code unit to run through the Job Queue on a schedule. Not sure if this will change anything I have to do.

    Thanks,

    Troy

  • Verified answer
    JAngle Profile Picture
    73 on 04 Sep 2020 at 19:06:22
    RE: XMLPort Problem Filtering table - .CSV output

    Try using setrange instead of setfilter. The field in question is an option field so the syntax is specific “Prod. Order Line”. Setrange(status, “Prod. Order Line”.Status::Released).

    Failing that you can set these types of filters on the table data item of the XML port instead of in code. Highlight the line and choose the properties to open table filter edit window

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,361 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,522 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Loading complete