SETSELECTIONFILTER on subpage in RTC

zeonzeon Member Posts: 130
edited 2014-10-17 in NAV Three Tier
Hi,

I have some problems with the SETSELECTIONFILTER on a subpage in RTC. I need to find the Sales Lines that the user have marked, and send them to a report afterwards. So, on Page 42 Sales Order I have a button with the code.
CurrPage.SalesLines.FORM.OpenCopyCalcLines;

And on the Sales Order Subform I have the following code:
CurrPage.SETSELECTIONFILTER(SalesLine);
IF SalesLine.FINDSET THEN
  REPEAT
    MESSAGE(FORMAT(SalesLine."Line No."));
  UNTIL SalesLine.NEXT = 0;

My problem is that the message about the line selected is always one step behind. E.g the user selects Line No. 10000. Then the message shows the lines that were marked before. Then when the user selects a new set of lines it will then show Line No. 10000, which was selected previously.

What the heck am I doing wrong?

Answers

  • Purvesh_MaisuriaPurvesh_Maisuria Member Posts: 71
    Hi,

    CurrPage.SETSELECTIONFILTER(SalesLine);

    SalesLine.MARKEDONLY(TRUE); // I think you forgot to write this line.

    IF SalesLine.FINDSET THEN
    REPEAT
    MESSAGE(FORMAT(SalesLine."Line No."));
    UNTIL SalesLine.NEXT = 0;

    Hope this will solve your problem.

    Thanks & Regards,
    Purvesh Maisuria.
  • TroelshTroelsh Member, Microsoft Employee Posts: 79
    You are not doing anything wrong. You just found a flaw :oops: in the current release ....
    Please stay tuned for the final NAV2013 release : :wink:

    Troels Bent Hansen
    Senior Program Manager
    Microsoft Dynamics NAV


    ****** This posting is provided "AS IS" with no warranties, and confers no rights ******
  • zeonzeon Member Posts: 130
    Thanks for your input, but this does not do the trick.

    As far as I know markedonly does not work in NAV2009 under RTC.
  • zeonzeon Member Posts: 130
    Troelsh wrote:
    You are not doing anything wrong. You just found a flaw :oops: in the current release ....
    Please stay tuned for the final NAV2013 release : :wink:

    But what is the best approach to handle these scenarios? The user selects a few lines on a subpage, and we as coders wants to handle these lines - send them to a report or codeunit or whatever?

    TIA
  • TroelshTroelsh Member, Microsoft Employee Posts: 79
    To do as you have done in the example; but instead pass the value(s) to a report.run.

    Troels Bent Hansen
    Senior Program Manager
    Microsoft Dynamics NAV


    ****** This posting is provided "AS IS" with no warranties, and confers no rights ******
  • pdjpdj Member Posts: 643
    SalesLine.MARKEDONLY(TRUE); // I think you forgot to write this line.
    No. You should never call this after SETSELECTIONFILTER. It will be set by NAV when needed.
    Regards
    Peter
  • vikoviko Member Posts: 2
    Hi guys, there's a bug in GETRECORD, SETSELECTIONFILTER in NAV 2013 R2. Check this out:
    Check this out: https://community.dynamics.com/nav/b/vi ... round.aspx
Sign In or Register to comment.