FileMan Delphi Components/GetIEN Example: Difference between revisions
From VistApedia
Jump to navigationJump to search
DavidWhitten (talk | contribs) No edit summary |
(No difference)
|
Revision as of 16:58, 8 February 2011
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;