Options

Problem with setselectionfilter and RunModal.

southindiansouthindian Member Posts: 247
edited 2015-09-28 in NAV Three Tier
I have a requirement in nav2013. In Sales order sub page(sub form) , add a new action button. When use clicks the action button, it should open a list page designed with ILE(3table 32). When he selects one or more that one records in the list page and click "OK" button in the list page. It should insert new lines in Sales Order Subpage, based on the selected records(MARKED ONLY) in List Page.

I have included following codes in Action Button of Sales order Subpage and in List Page, But not working

Action Button(Sales Order Sub Page)

ILE.reset;
ILE.setrange(entrytype,entrytype::Sales);
ILE.Setrange("Source No","Sell to customer No");
if Page.runbmodal(50123,ILE):= Action::Ok Then

List Page

Local Variable

ItemLedgerenty Record 32

ItemLedgerenty.copy(Rec);
currpage.setselectionfilter(ItemLedgerenty);


Iam able to get the marked record in list page by means of above code, but not able to carry that selected records to subpage.

Could any one help how to proceed with that.

Comments

  • Options
    Lokesh8262Lokesh8262 Member Posts: 3
    Try This Code

    ILE.reset;
    ILE.setrange(entrytype,entrytype::Sales);
    ILE.Setrange("Source No","Sell to customer No");
    if Page.runbmodal(50123,ILE):= Action::Ok Then
    "Source No" := ILE."Source No"

    Add Which Field you want to select and fill it to field.
  • Options
    vaprogvaprog Member Posts: 1,128
    Hi southindian,

    where in the page did you place the code you labeled "List Page" in your post, and most importantly, where and how do you call it?

    You need to place it in a global function with ItemLedgerenty as a VAR parameter. The ItemLedgerenty.COPY line is superfluous. Such a function is typically named SetSelection in standard NAV.
    PROCEDURE SetSelection(VAR ItemLedgerEntry : Record 32);
    BEGIN
      CurrPage.SETSELECTIONFILTER(ItemLedgerEntry);
    END;
    

    In the Sales Order subpage use a page variable:
    ...
    ILEListPage.LOOKUPMODE(TRUE);
    ILEListPage.SETTABLEVIEW(ILE);
    IF ILEListPage.RUNMODAL = ACTION::LookupOK THEN BEGIN
      ILEListPage.SetSelection(ILE);
      IF ILE.FINDSET THEN
        REPEAT
          DoWhatever(ILE);
        UNTIL ILE.NEXT = 0;
    END;
    
Sign In or Register to comment.