Markonly with settableview for the lookup page does not work.

Hi Expert.

I want to set some filters for some special senario, i repeat the records, and check some condition, if ok, i mark the record, after the repeat condition, i use markonly, and i got all records what i want, then use settableview, hope it can be displayed in the lookup page, but it doesn’t work. please check my code below.

 l_recSalesHdr.RESET;
    l_recSalesHdr.SETCURRENTKEY("Document Type","Posting Date");
    l_recSalesHdr.SETRANGE("Document Type",l_recSalesHdr."Document Type"::Order);
    l_recSalesHdr.SETRANGE("Completely Shipped",TRUE);    
    IF l_recSalesHdr.FIND('-') THEN 
    REPEAT
      IF DimVal1 <> '' THEN BEGIN
        l_recDimEntry.RESET;
        IF l_recDimEntry.GET(l_recSalesHdr."Dimension Set ID",DimCode1) THEN BEGIN
          l_Dimcode := l_recDimEntry."Dimension Value Code";
          IF STRPOS(DimVal1,l_Dimcode) > 0 THEN
            IF NOT CheckIfInWork(l_recSalesHdr) THEN
             l_recSalesHdr.MARK(TRUE);
        END;
      END ELSE IF DimVal2<> '' THEN BEGIN
        l_recDimEntry.RESET;
        IF l_recDimEntry.GET(l_recSalesHdr."Dimension Set ID",DimCode2) THEN BEGIN
          l_Dimcode := l_recDimEntry."Dimension Value Code";
          IF STRPOS(DimVal2,l_Dimcode) > 0 THEN
            IF NOT CheckIfInWork(l_recSalesHdr) THEN
              l_recSalesHdr.MARK(TRUE);
        END;
      END ELSE
        IF NOT CheckIfInWork(l_recSalesHdr) THEN
          l_recSalesHdr.MARK(TRUE);
    UNTIL l_recSalesHdr.NEXT = 0;
    l_recSalesHdr.MARKEDONLY(TRUE);
    l_PSalesList.SETTABLEVIEW(l_recSalesHdr);

Any suggestion will be warmly appreciated.

Gary.

SORRY, MY MISTAKE, IT WORKS, JUST ONLY 1 PB, THE PAGE WHICH POP UP, CAN NOT BE SEARCH ON THE OTHER FILTER.~

Is 1_PSalesList page is customised?

What do you mean by that?

Which version and buildno/cu of NAV and which client? Remember there used to be issues related to using MARK and MARKEDONLY.

If you are trying to use MARK in Dynamics NAV 201X then you’ll fail. The MARK function no longer works as it did in NAV 2009 and earlier.

You have to filter on the records and use SETSELECTIONFILTER.

Tak a look at the Appy function on e.g.the Customer Ledger Entries page or Apply in a Journal.

HI Palle ,

My version is NAV 2016, the code above works. i think it should be supported in nav 2016, I loop in the records and mark it. at last markonly, then , i pass the record to a page , and pop it up.

hi Erik, thanks for your reply, i mean the pop up page with the filter of mark, can not be applied to which out of the scope of the marking filter.

Palle is right. Mark/Markedonly is legacy functionality available only in the classic client, even if the functions are still in C/AL.

Read this blog post from [mention:a17e3d2616f1413190841e1e2a37fab1:e9ed411860ed4f2ba0265705b8793d05] on to do something similar in the role tailed clients:

https://markbrummel.blog/2014/03/07/tip-36-using-mark-and-markedonly-in-the-role-tailored-client/