The GetApplicationSetting method is a public function in the client-side Critique component. It accepts the name of a column in the Settings table of the FmLib database and the name of the server, and returns the value of the setting. This method will work for any additional settings that are added to the Settings table in the future.
An RDS.DataControl object is declared. The reason for using Remote Data Service (RDS) is that GetApplicationSetting is a method in a client-side component and RDS offers disconnected recordsets that minimize network traffic.
Dim RDS As New RDS.DataControl
The query that retrieves the value of a column in the Settings table is a call to the GetAppSetting query in the FmLibMap.ini file. Implementing a Handler in CML/LitCrit describes the content of the FmLibMap.ini file and how the CML/LitCrit application uses the handler object. When the Refresh method is called, after setting these properties on the RDS.DataControl, the RDS.DataFactory object is automatically called "behind the scenes" and RDS returns a Recordset object to the client.
RDS.ExecuteOptions = 1 ' adcExecSync
RDS.Handler = "MSDFMAP.Handler,FmLibMap.ini"
RDS.Server = "http://" & ServerName
RDS.Connect = "Data Source=FmLib"
RDS.SQL = "GetAppSetting(" & SettingName & ")"
RDS.Refresh
The Recordset property of the RDS.DataControl contains the result of a query and the function is assigned the value of the first field, index (0), in the recordset.
If Not RDS.Recordset.EOF Then
GetApplicationSetting = CStr(RDS.Recordset(0))
End If
The complete code for the GetApplicationSetting method is available in Critique.cls Client Side COM Component in the code section.