dlgroothuis
3/6/2020 - 9:50 AM

Page Navigation

// Snippet uses a local variable and a filtergroup to open a dialog for the user to select a given record. This record will then be used to fill the current working record
// Vars used: (local: lRecMasterData - Rec / lPgMasterDataList - Page) (System: Rec - Rec / CurrPage - Page)
WITH lRecMasterData DO BEGIN
  RESET;
  FILTERGROUP(10);
  SETRANGE(Type,184); // Set the filters
  FILTERGROUP(0);
END;
lPagMasterDataList.SETTABLEVIEW(lRecMasterData);
lPagMasterDataList.LOOKUPMODE(TRUE);
lPagMasterDataList.EDITABLE(FALSE);
IF lPagMasterDataList.RUNMODAL = ACTION::LookupOK THEN BEGIN // If the user presses OK, Get the selected record
  lPagMasterDataList.GETRECORD(lRecMasterData);
  Rec.VALIDATE("Certificate Type",lRecMasterData.Code); // Use field of selected record to fill the field on the working record
  CurrPage.UPDATE(TRUE); // Update the page to reflect the changes
END;