Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV forum

XMLPort Filter with second Table

Posted on by 2

Hello everyone,

I am trying to filter an XMLPort by another table. The XMLPort mainly contains fields from the HR_MA table. However, there is an additional table called NAPA_MA for personnel payroll.

The key in the HR_MA table is the field "No." and in NAPA_MA the field "Nr".

The filtering should be done based on the "Status" field in the NAPA_MA table. Only records that have the "Aktiv" status (option field) in NAPA_MA should be output.

Here is my attempt, which does not work as it always outputs all records from HR_MA.

HR_MA - Export::OnPreXMLItem()
WITH HR_MA DO BEGIN
  NAPA_MA.RESET;
  NAPA_MA.SETCURRENTKEY(Nr);
  NAPA_MA.SETRANGE(Nr, HR_MA."No.");
  NAPA_MA.SETFILTER(Status, 'Aktiv');
  IF FINDSET THEN BEGIN
    REPEAT
      HR_MA.MARK (TRUE);
    UNTIL NEXT = 0;
  END ELSE
    currXMLport.SKIP;
NAPA_MA.MARKEDONLY(TRUE);
END;

Does anyone have any suggestions for me?
Best regards

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,986 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans