Difference between revisions of "FileMan Delphi Components/FMDC Quick Start Guide"

From VistApedia
Jump to: navigation, search
 
Line 5: Line 5:
 
1. Establish an [[RPC Broker]] connection:
 
1. Establish an [[RPC Broker]] connection:
  
a. Add a [[TRPCBroker]] component to your form.
+
a. Add a [[FileMan_Delphi_Components/TRPCBroker|TRPCBroker]] [[Delphi_component|component]] to your [[Delphi_Form|form]].
  
 
b. Set its properties and invoke its methods as necessary to connect to a server system.
 
b. Set its properties and invoke its methods as necessary to connect to a server system.
  
2. Add a [[FileMan_Delphi_Components/TFMGets|TFMGets]] component to retrieve data:
+
2. Add a [[FileMan_Delphi_Components/TFMGets|TFMGets]] [[Delphi_component|component]] to retrieve data:
  
a. Add a [[FileMan_Delphi_Components/TFMGets|TFMGets]] component to your [[Delphi_Form|form]].
+
a. Add a [[FileMan_Delphi_Components/TFMGets|TFMGets]] [[Delphi_component|component]] to your [[Delphi_Form|form]].
b. Set its [[FileMan_Delphi_Components/RPCBroker_property|RPCBroker property]] to point to your [[Delphi_Form|form]]'s [[FileMan_Delphi_Components/TRPCBroker|TRPCBroker]] component.
+
b. Set its [[FileMan_Delphi_Components/RPCBroker_property|RPCBroker property]] to point to your [[Delphi_Form|form]]'s [[FileMan_Delphi_Components/TRPCBroker|TRPCBroker]] [[Delphi_component|component]].
  
 
c. Set its [[FileMan_Delphi_Components/FileNumber_property|FileNumber property]] to the [[VA FileMan File|file]] containing records to retrieve.
 
c. Set its [[FileMan_Delphi_Components/FileNumber_property|FileNumber property]] to the [[VA FileMan File|file]] containing records to retrieve.
  
3. Add a [[FileMan_Delphi_Components/TFMFiler|TFMFiler]] component to file changes:
+
3. Add a [[FileMan_Delphi_Components/TFMFiler|TFMFiler]] [[Delphi_component|component]] to file changes:
  
a. Add a [[FileMan_Delphi_Components/TFMFiler|TFMFiler]] component to your [[Delphi_Form|form]].
+
a. Add a [[FileMan_Delphi_Components/TFMFiler|TFMFiler]] [[Delphi_component|component]] to your [[Delphi_Form|form]].
  
b. Set its [[FileMan_Delphi_Components/RPCBroker_property|RPCBroker property]] to point to your form's TRPCBroker component.
+
b. Set its [[FileMan_Delphi_Components/RPCBroker_property|RPCBroker property]] to point to your [[Delphi_Form|form]]'s [[FileMan_Delphi_Components/TRPCBroker|TRPCBroker]] [[Delphi_component|component]].
  
4. Add a [[FileMan_Delphi_Components/TFMValidator|TFMValidator]] component to provide validation services:
+
4. Add a [[FileMan_Delphi_Components/TFMValidator|TFMValidator]] [[Delphi_component|component]] to provide validation services:
  
a. Add a [[FileMan_Delphi_Components/TFMValidator|TFMValidator]] component to your [[Delphi_Form|form]].
+
a. Add a [[FileMan_Delphi_Components/TFMValidator|TFMValidator]] [[Delphi_component|component]] to your [[Delphi_Form|form]].
  
b. Set its RPCBroker property to point to your form's TRPCBroker component.
+
b. Set its [[FileMan_Delphi_Components/RPCBroker_property|RPCBroker property]] to point to your [[Delphi_Form|form]]'s [[FileMan_Delphi_Components/TRPCBroker|TRPCBroker]] [[Delphi_component|component]].
  
5. Add VA FileMan data controls for each field:
+
5. Add VA FileMan data controls for each [[VA_FileMan_field|field]]:
  
a. For each field to edit, add data control(s) and supporting data access components to your form as follows:
+
a. For each [[VA FileMan field|field]] to edit, add data control(s) and supporting data access components to your [[Delphi_Form|form]] as follows:
  
 
<table>
 
<table>
<tr><th>For this Field Type</th><th>Add to Your Form</th></tr>
+
<tr><th>For this [[VA_FileMan_field_data_type|Field Type]]</th><th>Add to Your [[Delphi_Form|Form]]</th></tr>
  
<tr><td>Free text, Numeric, Date</td><td>1 TFMEdit</td></tr>
+
<tr><td>[[Free_Text_Data_Type%7E|Free text]], [[Numeric_Data_Type%7E|Numeric]], [[Date/Time_Data_Type%7E|Date]]</td><td>1 TFMEdit</td></tr>
  
<tr><td>"Boolean" Set of Codes</td><td>1 TFMCheckBox</td></tr>
+
<tr><td>"Boolean" [[Set_of_Codes_Data_Type%7E|Set of Codes]]</td><td>1 TFMCheckBox</td></tr>
  
<tr><td>Set of Codes</td><td><table><tr><td>1 TFMRadioGroup, or</td>
+
<tr><td>[[Set_of_Codes_Data_Type%7E|Set of Codes]]</td><td><table><tr><td>1 TFMRadioGroup, or</td>
 
<TR><td>1 TPanel, plus 1 TFMRadioButton per code</td></tr>
 
<TR><td>1 TPanel, plus 1 TFMRadioButton per code</td></tr>
 
</TABLE></tr>
 
</TABLE></tr>
  
 
<tr><td>Word Processing</td><td>1 TFMMemo</td></tr>
 
<tr><td>Word Processing</td><td>1 TFMMemo</td></tr>
<tr><td>Pointer</td><td><TABLE><TR>1 TFMLister and 1 TFMListBox, or</td></tr>
+
<tr><td>[[Pointer_to_a_File_Data_Type%7E|Pointer]]</td><td><TABLE><TR>1 TFMLister and 1 TFMListBox, or</td></tr>
  
 
<tr><td>1 TFMLister and 1 TFMComboBox, or</td></tr>
 
<tr><td>1 TFMLister and 1 TFMComboBox, or</td></tr>
Line 50: Line 50:
 
</table></tr>
 
</table></tr>
  
<tr><td>Computed</td><td>1 TFMLabel</td></tr>
+
<tr><td>[[Computed_Data_Type%7E|Computed]]</td><td>1 TFMLabel</td></tr>
 
</table>
 
</table>
  
b. Set the properties of these controls and components according to the field-specific guidelines for the field type: Free text, numeric, date - "Boolean" set of codes - Set of Codes - Word Processing - Pointer - Computed.
+
b. Set the properties of these controls and [[Delphi_component|component]]s according to the [[VA_FileMan_field|field]]-specific guidelines for the [[VA_FileMan_field_data_type|Field Type]]: Free text, numeric, date - "Boolean" set of codes - Set of Codes - Word Processing - Pointer - Computed.
  
 
6. Select and retrieve a record:
 
6. Select and retrieve a record:
  
a. To select a record, follow the procedure in Select a record with the TFMLookUp custom dialog. You'll add a TFMLookUp and TFMLister component to your form, and add a button that calls the TFMLookup's Execute method to perform the lookup.
+
a. To select a record, follow the procedure in Select a record with the TFMLookUp custom dialog. You'll add a TFMLookUp and TFMLister [[Delphi_component|component]] to your [[Delphi_Form|form]], and add a button that calls the TFMLookup's Execute method to perform the lookup.
b. TFMLookUp.Execute returns a record number. With this record number, you can retrieve the record and populate your data controls with the record's field values. To retrieve the record, follow the procedure in the "How to Retrieve a Record" topic. You'll call the TFMGets GetAndFill method to retrieve the record and populate data controls.
+
b. TFMLookUp.Execute returns a record number. With this record number, you can retrieve the record and populate your data controls with the record's [[VA_FileMan_field|field]] values. To retrieve the record, follow the procedure in the "How to Retrieve a Record" topic. You'll call the [[FileMan_Delphi_Components/TFMGets|TFMGets]] [[FileMan_Delphi_Components/TFMGets|TFMGets_GetAndFill|GetAndFill]] method to retrieve the record and populate data controls.
  
 
c. The code for the button that executes TFMLookup's Execute method (step a) can also perform the retrieval (step b). The code that combines these tasks would look similar to the following:
 
c. The code for the button that executes TFMLookup's Execute method (step a) can also perform the retrieval (step b). The code that combines these tasks would look similar to the following:
 
+
<code>
 
procedure TForm1.Button1Click(Sender: TObject);
 
procedure TForm1.Button1Click(Sender: TObject);
 
var AddRecord:Boolean;
 
var AddRecord:Boolean;
Line 75: Line 75:
  
 
end;
 
end;
 
+
</code>
 
7. Set up Automated OnExit Processing:
 
7. Set up Automated OnExit Processing:
  
a. Your data controls should already be linked to a TFMFiler and a TFMValidator component, from following the Data Control Property Settings for All Field Types guidelines when you set up each data control on your form.
+
a. Your data controls should already be linked to a [[FileMan_Delphi_Components/TFMFiler|TFMFiler]] and a [[FileMan_Delphi_Components/TFMValidator|TFMValidator]] [[Delphi_component|component]], from following the Data Control Property Settings for All [[VA_FileMan_field_data_type|Field Type]]s guidelines when you set up each data control on your [[Delphi_Form|form]].
  
 
b. Set every data control's coValOnExit value to True, in each control's FMCtrlOptions property.
 
b. Set every data control's coValOnExit value to True, in each control's FMCtrlOptions property.
Line 84: Line 84:
 
8. Provide an event to save changes:
 
8. Provide an event to save changes:
  
a. To save changes the user makes to the record, follow the procedure in the "How to File Changes" topic. You'll add a button whose caption is something like "Save Changes." You'll add code for this button's OnClick event handler that calls your TFMFiler's Update method to file changes.
+
a. To save changes the user makes to the record, follow the procedure in the "How to File Changes" topic. You'll add a button whose caption is something like "Save Changes." You'll add code for this button's OnClick event handler that calls your [[FileMan_Delphi_Components/TFMFiler|TFMFiler]]'s [[FileMan_Delphi_Components/TFMFiler|TFMFiler_Update|Update]] method to file changes.
  
9. (Optional) Provide context-sensitive field help:
+
9. (Optional) Provide context-sensitive [[VA_FileMan_field|field]] help:
  
You can retrieve the field-based help from the data dictionary in several ways:
+
You can retrieve the [[VA_FileMan_field|field]]-based help from the data dictionary in several ways:
  
· F1 field help in pop-up window
+
· F1 [[VA_FileMan_field|field]] help in pop-up window
  
· F1 field help in pop-up window for TFMRadioGroup Controls
+
· F1 [[VA_FileMan_field|field]] help in pop-up window for TFMRadioGroup Controls
  
 
· Automatic OnFocus Display of help in a TPanel
 
· Automatic OnFocus Display of help in a TPanel
Line 100: Line 100:
 
10. Register your application:
 
10. Register your application:
  
Registering your application is part of RPC Broker security. For all users that do not possess the XUPROGMODE key, your application must register itself based on a "B"-type option in the Option file on the server.
+
Registering your application is part of [[RPC Broker]] security. For all users that do not possess the XUPROGMODE key, your application must register itself based on a "B"-type option in the Option file on the server.
  
 
The RPC multiple of this option must include the RPCs invoked by all VA FileMan Delphi Components methods that your application uses.
 
The RPC multiple of this option must include the RPCs invoked by all VA FileMan Delphi Components methods that your application uses.
Line 106: Line 106:
 
For a listing of the RPC invoked by each VA FileMan Delphi Components method, please refer to the "Security & Registering FMDC RPCs" topic.
 
For a listing of the RPC invoked by each VA FileMan Delphi Components method, please refer to the "Security & Registering FMDC RPCs" topic.
  
For more information on RPC Broker security, please refer to the documentation for the RPC Broker.
+
For more information on RPC Broker security, please refer to the documentation for the [[RPC Broker]].

Revision as of 19:08, 7 February 2011

This quick start guide goes immediately to the heart of the matter, showing you how to edit records in a particular file using the VA FileMan Delphi Components (FMDC).

To edit records in a given VA FileMan file with the VA FileMan Delphi Components:

1. Establish an RPC Broker connection:

a. Add a TRPCBroker component to your form.

b. Set its properties and invoke its methods as necessary to connect to a server system.

2. Add a TFMGets component to retrieve data:

a. Add a TFMGets component to your form. b. Set its RPCBroker property to point to your form's TRPCBroker component.

c. Set its FileNumber property to the file containing records to retrieve.

3. Add a TFMFiler component to file changes:

a. Add a TFMFiler component to your form.

b. Set its RPCBroker property to point to your form's TRPCBroker component.

4. Add a TFMValidator component to provide validation services:

a. Add a TFMValidator component to your form.

b. Set its RPCBroker property to point to your form's TRPCBroker component.

5. Add VA FileMan data controls for each field:

a. For each field to edit, add data control(s) and supporting data access components to your form as follows:

For this Field TypeAdd to Your Form
Free text, Numeric, Date1 TFMEdit
"Boolean" Set of Codes1 TFMCheckBox
Set of Codes
1 TFMRadioGroup, or
1 TPanel, plus 1 TFMRadioButton per code
Word Processing1 TFMMemo
Pointer1 TFMLister and 1 TFMListBox, or</td>

<tr><td>1 TFMLister and 1 TFMComboBox, or</td></tr> <tr><td>1 TFMLister and 1 TFMComboBoxLookUp</td></tr> </table></tr>

<tr><td>Computed</td><td>1 TFMLabel</td></tr> </table>

b. Set the properties of these controls and components according to the field-specific guidelines for the Field Type: Free text, numeric, date - "Boolean" set of codes - Set of Codes - Word Processing - Pointer - Computed.

6. Select and retrieve a record:

a. To select a record, follow the procedure in Select a record with the TFMLookUp custom dialog. You'll add a TFMLookUp and TFMLister component to your form, and add a button that calls the TFMLookup's Execute method to perform the lookup. b. TFMLookUp.Execute returns a record number. With this record number, you can retrieve the record and populate your data controls with the record's field values. To retrieve the record, follow the procedure in the "How to Retrieve a Record" topic. You'll call the TFMGets TFMGets_GetAndFill|GetAndFill method to retrieve the record and populate data controls.

c. The code for the button that executes TFMLookup's Execute method (step a) can also perform the retrieval (step b). The code that combines these tasks would look similar to the following: procedure TForm1.Button1Click(Sender: TObject); var AddRecord:Boolean; begin

 if FMLookup1.Execute(AddRecord) then begin
   FMGets1.IENS:=FMLookUp1.RecordNumber+',';
   // Call any TFMListBox/TFMComboBox GetList methods
   // here, before calling GetAndFill.
   FMGets1.GetAndFill;
 end
 else
   ShowMessage('No record chosen.');

end; 7. Set up Automated OnExit Processing:

a. Your data controls should already be linked to a TFMFiler and a TFMValidator component, from following the Data Control Property Settings for All Field Types guidelines when you set up each data control on your form.

b. Set every data control's coValOnExit value to True, in each control's FMCtrlOptions property.

8. Provide an event to save changes:

a. To save changes the user makes to the record, follow the procedure in the "How to File Changes" topic. You'll add a button whose caption is something like "Save Changes." You'll add code for this button's OnClick event handler that calls your TFMFiler's TFMFiler_Update|Update method to file changes.

9. (Optional) Provide context-sensitive field help:

You can retrieve the field-based help from the data dictionary in several ways:

· F1 field help in pop-up window

· F1 field help in pop-up window for TFMRadioGroup Controls

· Automatic OnFocus Display of help in a TPanel

· Calling a TFMHelp component directly

10. Register your application:

Registering your application is part of RPC Broker security. For all users that do not possess the XUPROGMODE key, your application must register itself based on a "B"-type option in the Option file on the server.

The RPC multiple of this option must include the RPCs invoked by all VA FileMan Delphi Components methods that your application uses.

For a listing of the RPC invoked by each VA FileMan Delphi Components method, please refer to the "Security & Registering FMDC RPCs" topic.

For more information on RPC Broker security, please refer to the documentation for the RPC Broker.