FileMan Delphi Components/GetIEN Example

From VistApedia
Revision as of 13:30, 7 April 2012 by NeilArmstrong (talk | contribs) (Added glossary link to Record~)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

GetIEN Example

The following code is for a button's OnClick event. The code takes a value a user has typed in the UserName TFMEdit data control, and uses a TFMFindOne component to look up that value in file 200. The return value is placed in the IENS property of a TFMGets component, and all data controls on the form are populated with the retrieved Record.

procedure TForm1.Button1Click(Sender: TObject);

 var rec:integer;

begin

 // FMGets1 is a TFMGets, w/FileNumber=200
 // FMFindOne1 is a TFMFindOne component.
 FMGets1.IENS:=;
 FMFindOne1.Value:=UserName.Text;
 FMFindOne1.FileNumber:='200';
 rec:=FMFindOne1.GetIEN;
 if rec=-1 then
   FMFindOne1.DisplayErrors
 else if rec>0 then
 begin
   FMGets1.IENS:=IntToStr(rec)+',';
   FMGets1.GetAndFill;
 end
 else
   ShowMessage('No Records matched.');

end;