Thursday, November 7, 2019

NAV - Custom On Lookup Dropdown

Simple lookup filter

field(Barcode; Barcode)

                {

                    ApplicationArea = All;

                    Lookup = true;

                    TableRelation = "LSC Barcodes"."Barcode No." WHERE("Item No."=field(Item));

}

OR
*Restart instance after making this modification.

On Page, Set Lookup = Yes

Name DataType Subtype Length
WRL Record Posted Whse. Receipt Lines
RecList Page Posted Whse. Receipt List
FromDate Date
ToDate Date
LPS Record Label Printing Setup


IF LPS.FINDFIRST THEN BEGIN
  FromDate := CALCDATE('-'+FORMAT(LPS."Show Receipts in Range"),TODAY);
  ToDate := CALCDATE(FORMAT(LPS."Show Receipts in Range"),TODAY);
END;
WRL.RESET;
WRL.CALCFIELDS("PO Type Code");
WRL.SETRANGE("PO Type Code",POTypeCode);
CLEAR(RecList);
RecList.SETRECORD(WRL);
RecList.SETTABLEVIEW(WRL);
RecList.LOOKUPMODE(TRUE);
  IF RecList.RUNMODAL = ACTION::LookupOK THEN BEGIN
    RecList.GETRECORD(WRL);
     VALIDATE(Receipt,WRL."No.");
  END;


field("Production Order"; "Production Order")
            {
                ApplicationArea = All;
                lookup = True;
                trigger OnLookup(var TextText)Boolean
                var
                    Prdord: record "Production Order";
                    RecList: page "Production Order List";
                    FromDate: date;
                    ToDate: Date;

                begin
                    FromDate := CALCDATE('-' + FORMAT('30D'), TODAY);
                    ToDate := CALCDATE(FORMAT('30D'), TODAY);
                    //Prdord.setrange("Starting Date",fromdate,ToDate);

                    CLEAR(RecList);
                    RecList.SETRECORD(Prdord);
                    RecList.SETTABLEVIEW(PrdOrd);
                    RecList.LOOKUPMODE(TRUE);
                    IF RecList.RUNMODAL = ACTION::LookupOK THEN BEGIN
                        RecList.GETRECORD(PrdOrd);
                        VALIDATE("Production Order", Prdord."No.");
                    END;
                end;

No comments:

Post a Comment