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

From VistApedia
Jump to: navigation, search
(6. Select and retrieve a record:)
(6. Select and retrieve a record:)
Line 62: Line 62:
 
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 "[[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 and populate data controls.
 
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 "[[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 and populate data controls.
  
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:
+
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:
  
 
<code>
 
<code>

Revision as of 23:56, 7 February 2011

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 [[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 TFMLookUp_Execute|Execute method to perform the lookup. b. 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 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.