Usage of CurrPage.SetSelectionFilter()

Hi, I want to use CurrPage.SetSelectionFilter() to pick the current selected record on a lookup page as the page has composite primary keys.
The question is can I do that? And where to write the function? Page? Table? Inside the definition of the lookUp field?

Thanks in advance.

Answers

  • KTA8KTA8 Member Posts: 388
    Normally you want that to perform some action, so in that action. Is a page action so on the page.
  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    edited 2018-10-26
    SETSELECTIONFILTER uses MARKs top mark records selected on the page.

    The PK structure of underlying record does not matter, as you would normally use SETSELECTIONFILTER like this:
    CurrPage.SETSELECTIONFILTER(a_record_var_of_the_same_type_as_page_source_record);
    a_record_var_of_the_same_type_as_page_source_record.MARKEDONLY(TRUE);
    IF a_record_var_of_the_same_type_as_page_source_record.FINDSET THEN
    REPEAT 
     // do your stuff with selected a_record_var_of_the_same_type_as_page_source_record one by one
    UNTIL a_record_var_of_the_same_type_as_page_source_record.NEXT=0
    

    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • vaprogvaprog Member Posts: 1,116
    Hi, I want to use CurrPage.SetSelectionFilter() to pick the current selected record on a lookup page as the page has composite primary keys.
    The question is can I do that?
    I answered that question in your other thread.
    And where to write the function? Page? Table? Inside the definition of the lookUp field?

    What is "the lookUp field" supposed to be?

    Since the function is called through (as a method of) CurrPage, the only place you can call it from is the page, because CurrPage only exists there.

    Usually you call the containing code block either from an Action on the page itself, or you call it from a page variable anywhere by way of a global procedure in the page object.

    By the way, SETSELECTIONFILTER uses marks in most cases, but not if either only one record was selected, or if all records within the filter were selected. SETSELECTIONFILTER turns MARKEDONLY on or off as needed. So, in generall, don't mess with MARKEDONLY after you have called SETSELECTIONFILTER.

    And there's another mistake in Slawek's example code: MARKEDONLY works like a property of an object. Used as in the example code, it just returns it's current value. To set the filter use MARKEDONLY(TRUE) or MARKEDONLY := TRUE

  • Slawek_GuzekSlawek_Guzek Member Posts: 1,690
    Thank's @Vaprog, I've edited it.
    Slawek Guzek
    Dynamics NAV, MS SQL Server, Wherescape RED;
    PRINCE2 Practitioner - License GR657010572SG
    GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
  • RockWithNAVRockWithNAV Member Posts: 1,139

    Hi, I want to use CurrPage.SetSelectionFilter() to pick the current selected record on a lookup page as the page has composite primary keys.
    The question is can I do that? And where to write the function? Page? Table? Inside the definition of the lookUp field?

    Thanks in advance.

    CurrPage - Its clearly saying Page so you cant use it in Table :smile:
  • krikikriki Member, Moderator Posts: 9,094
    [Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.