Difference between revisions of "FileMan Delphi Components/GetIEN Example"
From VistApedia
DavidWhitten (talk | contribs) |
(Added glossary link to Record~) |
||
Line 1: | Line 1: | ||
== GetIEN Example == | == GetIEN Example == | ||
− | The following code is for a button's OnClick event. The code takes a value a user has typed in the UserName [[FileMan_Delphi_Components/TFMEdit|TFMEdit]] data control, and uses a [[FileMan_Delphi_Components/TFMFindOne|TFMFindOne]] component to look up that value in [[file 200]]. The return value is placed in the [[FileMan_Delphi_Components/TFMGets_IENS|IENS]] property of a [[FileMan_Delphi_Components/TFMGets|TFMGets]] component, and all data controls on the form are populated with the retrieved record. | + | The following code is for a button's OnClick event. The code takes a value a user has typed in the UserName [[FileMan_Delphi_Components/TFMEdit|TFMEdit]] data control, and uses a [[FileMan_Delphi_Components/TFMFindOne|TFMFindOne]] component to look up that value in [[file 200]]. The return value is placed in the [[FileMan_Delphi_Components/TFMGets_IENS|IENS]] property of a [[FileMan_Delphi_Components/TFMGets|TFMGets]] component, and all data controls on the form are populated with the retrieved [[record~|Record]]. |
<code> | <code> | ||
Line 22: | Line 22: | ||
end | end | ||
else | else | ||
− | ShowMessage('No | + | ShowMessage('No [[record~|Record]]s matched.'); |
end; | end; | ||
</code> | </code> |
Latest revision as of 13:30, 7 April 2012
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;