Page (subform) not filtering properly

mtlmonkmtlmonk Member Posts: 48
Hi,

I've got a page with a subform in it where I need to pass custom filters, rather than using the SubPageLink property on the page.

However, when inside the subform, I don't see any filter set on Rec variable so the subform just shows all comments found in the table it is linked to.

OrderComment.SETRANGE("Contract No.","No.");
OrderComment.SETFILTER("Change Order No.","Change Order No.");
CurrPage.CommentsSubForm.PAGE.SETTABLEVIEW(OrderComment);
CurrPage.CommentsSubForm.PAGE.UPDATE;

OrderComment is a global variable, not temporary one

It works well under Nav2013R2 but not in 2016

Answers

  • archer89archer89 Member Posts: 337
    follow https://msdn.microsoft.com/de-de/library/dd355387(v=nav.90).aspx

    Remark: SETTABLEVIEW is not supported for setting views on subpages from code on table headers. For example, you cannot set a table view on the SalesOrder subpage from the SalesHeader.
    best regards
    Franz Kalchmair, MVP
    Alias: Jonathan Archer

    please like / agree / verify my answer, if it was helpful for you. thx.
    Blog: http://moxie4nav.wordpress.com/
  • mtlmonkmtlmonk Member Posts: 48
    What's weird, same code works in 2013R2
  • archer89archer89 Member Posts: 337
    create a function in subpage with VAR parameter OrderComment, in that function read filter using getfilter(s), set that filter using setfilter(s) to rec.
    call that function before subpage.update.
    best regards
    Franz Kalchmair, MVP
    Alias: Jonathan Archer

    please like / agree / verify my answer, if it was helpful for you. thx.
    Blog: http://moxie4nav.wordpress.com/
  • mtlmonkmtlmonk Member Posts: 48
    Tried that...

    function xyz(var ordercomment)
    rec.copyfilters(ordercomment);

    Didn't work.
Sign In or Register to comment.