FileMan Delphi Components/FMDC Quick Start Guide

From VistApedia
Jump to: navigation, search

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