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

From VistApedia
Jump to: navigation, search
(Added glossary link to Record~)
 
(16 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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).
+
= Introduction =
 +
This quick start guide goes immediately to the heart of the matter, showing you how to edit [[record~|Record]]s 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:
+
= Quick Start Steps =
 +
To edit [[record~|Record]]s in a given VA FileMan file with the VA FileMan Delphi Components:
  
1. Establish an [[RPC Broker]] connection:
+
== 1. Establish an [[RPC Broker]] connection: ==
  
 
a. Add a [[FileMan_Delphi_Components/TRPCBroker|TRPCBroker]] [[Delphi_component|component]] to your [[Delphi_Form|form]].
 
a. Add a [[FileMan_Delphi_Components/TRPCBroker|TRPCBroker]] [[Delphi_component|component]] to your [[Delphi_Form|form]].
Line 9: Line 11:
 
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]] [[Delphi_component|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]] [[Delphi_component|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]] [[Delphi_component|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]] containing [[record~|Record]]s to retrieve.
  
3. Add a [[FileMan_Delphi_Components/TFMFiler|TFMFiler]] [[Delphi_component|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]] [[Delphi_component|component]] to your [[Delphi_Form|form]].
 
a. Add a [[FileMan_Delphi_Components/TFMFiler|TFMFiler]] [[Delphi_component|component]] to your [[Delphi_Form|form]].
Line 22: Line 24:
 
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]].
 
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]] [[Delphi_component|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]] [[Delphi_component|component]] to your [[Delphi_Form|form]].
 
a. Add a [[FileMan_Delphi_Components/TFMValidator|TFMValidator]] [[Delphi_component|component]] to your [[Delphi_Form|form]].
Line 28: Line 30:
 
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]].
 
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 [[VA_FileMan_field|field]]:
+
== 5. Add VA FileMan data controls for each [[VA_FileMan_field|field]]: ==
  
 
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:
 
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:
Line 43: Line 45:
 
</TABLE></tr>
 
</TABLE></tr>
  
<tr><td>Word Processing</td><td>1 [[FileMan_Delphi_Components/TFMMemo|TFMMemo]]</td></tr>
+
<tr><td>[[Word_Processing_Data_Type%7E|Word Processing]]</td><td>1 [[FileMan_Delphi_Components/TFMMemo|TFMMemo]]</td></tr>
 
<tr><td>[[Pointer_to_a_File_Data_Type%7E|Pointer]]</td><td><TABLE><TR>1 [[FileMan_Delphi_Components/TFMLister|TFMLister]] and 1 [[FileMan_Delphi_Components/TFMListBox|TFMListBox]], or</td></tr>
 
<tr><td>[[Pointer_to_a_File_Data_Type%7E|Pointer]]</td><td><TABLE><TR>1 [[FileMan_Delphi_Components/TFMLister|TFMLister]] and 1 [[FileMan_Delphi_Components/TFMListBox|TFMListBox]], or</td></tr>
  
Line 50: Line 52:
 
</table></tr>
 
</table></tr>
  
<tr><td>[[Computed_Data_Type%7E|Computed]]</td><td>1 TFMLabel</td></tr>
+
<tr><td>[[Computed_Data_Type%7E|Computed]]</td><td>1 [[FileMan_Delphi_Components/TFMLabel|TFMLabel]]</td></tr>
 
</table>
 
</table>
  
 
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]]: [[FileMan_Delphi_Components/Free_text|Free text]], [[FileMan_Delphi_Components/numeric|numeric]], [[FileMan_Delphi_Components/date|date]] - [[FileMan_Delphi_Components/Boolean_set_of_codes|"Boolean" set of codes]] - [[FileMan_Delphi_Components/Set_of_Codes|Set of Codes]] - [[FileMan_Delphi_Components/Word_Processing|Word Processing]] - [[FileMan_Delphi_Components/Pointer|Pointer]] - [[FileMan_Delphi_Components/Computed|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]]: [[FileMan_Delphi_Components/Free_text|Free text]], [[FileMan_Delphi_Components/numeric|numeric]], [[FileMan_Delphi_Components/date|date]] - [[FileMan_Delphi_Components/Boolean_set_of_codes|"Boolean" set of codes]] - [[FileMan_Delphi_Components/Set_of_Codes|Set of Codes]] - [[FileMan_Delphi_Components/Word_Processing|Word Processing]] - [[FileMan_Delphi_Components/Pointer|Pointer]] - [[FileMan_Delphi_Components/Computed|Computed]].
  
6. Select and retrieve a record:
+
== 6. Select and retrieve a [[record~|Record]]: ==
  
a. To select a record, follow the procedure in Select a record with the [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]] custom dialog. You'll add a [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]] and [[FileMan_Delphi_Components/TFMLister|TFMLister]] [[Delphi_component|component]] to your [[Delphi_Form|form]], and add a button that calls the [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]]'s [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp_Execute|Execute]] method to perform the lookup.
+
a. To select a [[record~|Record]], follow the procedure in the topic "[[FileMan_Delphi_Components/TFMLookUp_Select_a_record_custom_dialog|Select a record with the TFMLookUp custom dialog]]". You'll add a [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]] and [[FileMan_Delphi_Components/TFMLister|TFMLister]] [[Delphi_component|component]] to your [[Delphi_Form|form]], and add a button that calls the [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]]'s [[FileMan_Delphi_Components/TFMLookUp_Execute|Execute]] method to perform the lookup.
b. [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]].[[FileMan_Delphi_Components/TFMLookUp|TFMLookUp_Execute|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.
+
 
 +
b. [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]].[[FileMan_Delphi_Components/TFMLookUp_Execute|Execute]] returns a [[record~|Record]] number. With this [[record~|Record]] number, you can retrieve the [[record~|Record]] and populate your data controls with the [[record~|Record]]'s [[VA_FileMan_field|field]] values. To retrieve the [[record~|Record]], follow the procedure in the "[[FileMan_Delphi_Components/Retrieve_a_Record|How to Retrieve a Record]]" topic. You'll call the [[FileMan_Delphi_Components/TFMGets|TFMGets]] [[FileMan_Delphi_Components/TFMGets_GetAndFill|GetAndFill]] method to retrieve the [[record~|Record]] and populate data controls.
 +
 
 +
c. The code for the button that executes [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]]'s [[FileMan_Delphi_Components/TFMLookUp_Execute|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 [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp]]'s [[FileMan_Delphi_Components/TFMLookUp|TFMLookUp_Execute|Execute]] method (step a) can also perform the retrieval (step b). The code that combines these tasks would look similar to the following:
 
 
<code>
 
<code>
 
procedure TForm1.Button1Click(Sender: TObject);
 
procedure TForm1.Button1Click(Sender: TObject);
var AddRecord:Boolean;
+
var Add[[Record~|Record]]:Boolean;
 
begin
 
begin
   if FMLookup1.Execute(AddRecord) then begin
+
   if FMLookup1.Execute(Add[[Record~|Record]]) then begin
     FMGets1.IENS:=FMLookUp1.RecordNumber+',';
+
     FMGets1.IENS:=FMLookUp1.[[Record~|Record]]Number+',';
 
     // Call any TFMListBox/TFMComboBox GetList methods
 
     // Call any TFMListBox/TFMComboBox GetList methods
 
     // here, before calling GetAndFill.
 
     // here, before calling GetAndFill.
Line 72: Line 76:
 
   end
 
   end
 
   else
 
   else
     ShowMessage('No record chosen.');
+
     ShowMessage('No [[record~|Record]] chosen.');
  
 
end;
 
end;
 
</code>
 
</code>
7. Set up Automated OnExit Processing:
 
  
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]].
+
== 7. Set up Automated OnExit Processing: ==
 +
 
 +
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 [[FileMan_Delphi_Components/Data_Control_Property_Settings_For_All_Field Types|Data Control Property Settings for All 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 [[FileMan_Delphi_Components/FMCtrlOptions_property|FMCtrlOptions property]].
  
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 [[FileMan_Delphi_Components/TFMFiler|TFMFiler]]'s [[FileMan_Delphi_Components/TFMFiler|TFMFiler_Update|Update]] method to file changes.
+
a. To save changes the user makes to the [[record~|Record]], follow the procedure in the "[[FileMan_Delphi_Components/How_To_File_Changes|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 [[VA_FileMan_field|field]] help:
+
== 9. (Optional) Provide context-sensitive [[VA_FileMan_field|field]] help: ==
  
 
You can retrieve the [[VA_FileMan_field|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 [[VA_FileMan_field|field]] help in pop-up window
+
* [[FileMan_Delphi_Components/F1_field_help_in_pop-up_window|F1 field help in pop-up window]]
  
· F1 [[VA_FileMan_field|field]] help in pop-up window for [[FileMan_Delphi_Components/TFMRadioGroup|TFMRadioGroup]] Controls
+
* [[FileMan_Delphi_Components/F1_field_help_in_pop-up_window_for_TFMRadioGroup_Controls|F1 field help in pop-up window for TFMRadioGroup Controls]]
  
· Automatic OnFocus Display of help in a [[FileMan_Delphi_Components/TPanel|TPanel]]
+
* [[FileMan_Delphi_Components/Automatic_OnFocus_Display_of_help_in_a_TPanel|Automatic OnFocus Display of help in a TPanel]]
  
· Calling a TFMHelp component directly
+
* [[FileMan_Delphi_Components/Calling_A_TFMHelp_component|Calling a]][[FileMan_Delphi_Components/TFMHelp|TFMHelp]] [[Delphi_component|component]] directly
  
10. Register your application:
+
== 10. Register your [[application~|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~|Application]] is part of [[RPC Broker]] security. For all users that do not possess the XUPROGMODE key, your [[application~|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~|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 a listing of the [[REMOTE PROCEDURE CALL|RPC]] invoked by each VA FileMan Delphi Components method, please refer to the "[[FileMan_Delphi_Components/Security_And_Registering_FMDC_RPCS|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]].
 +
 +
= Overview Picture =
 +
[[Image:FMDC_Object_Hierarchy_.png]]

Latest revision as of 13:22, 7 April 2012

Introduction

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).

Quick Start Steps

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 VA FileMan 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 the topic "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 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:

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.

Overview Picture

FMDC Object Hierarchy .png