Hello everyone.
I'm creating a simple report (Dynamics NAV 2017), that reads data from two similar tables, joins all into one temporary and prints it into excel. All nice and simple. I've set the RequestedFilterField for both tables to "Document No.". Now as filters go, I can select single record, put a pipe (|) and select the next record ... works fine, but is extremely time consuming. My idea is, that when you drill down (or lookup, idk) into "Document No.", you could select multiple records (either with Shift or Ctrl) and when pressing OK it would fill my "Document No." filter with selected document numbers. I'm not sure if this can be achieved by standard funcionalities.
Any help is greatly appreciated.
Best regards, John
0
Answers
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
<Control1100494004> - OnLookup(VAR Text : Text[1024];) : Boolean
ThePage.SETTABLEVIEW(TheTable);
ThePage.EDITABLE(FALSE);
ThePage.LOOKUPMODE(TRUE);
IF ThePage.RUNMODAL=ACTION::LookupOK THEN BEGIN
ThePage.GetRecords(TheTable);
TheTable.MARKEDONLY(TRUE);
IF TheTable.FINDSET THEN BEGIN
CLEAR(FilterString);
REPEAT
IF FilterString = '' THEN
FilterString := TheTable."Transaction No."
ELSE
FilterString := (FilterString + '|' + TheTable."Transaction No.");
UNTIL TheTable.NEXT <= 0;
END;
END;
In ThePage create function:
GetRecords(VAR TheTableV : Record "The Table")
TheTableV.COPY(Rec);
TheTableV.MARKEDONLY(TRUE);
IF TheTableV.COUNT = 0 THEN BEGIN
TheTableV.COPY(Rec);
TheTableV.MARK(TRUE);
END;
TheTableV.MARKEDONLY(FALSE);
Try adding SETSELECTIONFILTER, this marks the records too. But in a different way.
GetRecords(VAR TheTableV : Record "The Table")
CurrPage.SETSELECTIONFILTER(Rec);
TheTableV.COPY(Rec);
TheTableV.MARKEDONLY(TRUE);
IF TheTableV.COUNT = 0 THEN BEGIN
TheTableV.COPY(Rec);
TheTableV.MARK(TRUE);
END;
TheTableV.MARKEDONLY(FALSE);
Check this out too:
https://docs.microsoft.com/en-us/dynamics-nav/setselectionfilter-function