Using Remote Views in Your Own Code

Most of the time in a client-server application, you will access remote views through forms you create with VPM Enterprise. There may be times, however, when your client-server application needs to access a remote view programmatically in your own code. This section describes how you do that.

Turn On Remote View

Before you can access a remote view in code, you must follow the instructions in Identifying and Turning On Matching Remote Views to activate the remote view.

OpenView Method

When you want to programmatically open a local or remote view, call the OpenView method of the Data Handler  object, instead of issuing the USE command directly.

Using the OpenView method will cause the remote version of a view to be opened if the remote view has been turned on, as described in the preceding section. The OpenView method checks the Database, View, and Use Remote View entries on the Edit-Properties page of the Data Builder when determining if the local or remote version of a view should be opened.

A view can be programmatically opened as follows:

ThisForm.oVPMDataHandler.OpenView(<parameters>)

Syntax:

OpenView(cView, cDatabase [,cAlias] [,lAdmin] [,lExclusive] [,lNoData] [,lNoRequery] [,lNoUpdate] [,lOnline] [,nDataSessionID])

Returns:

The value true (.T.) is returned if the view was opened. The value false (.F.) is returned if the view was not opened.

Arguments:

·       cView – The name of the view.

·       cDatabase – The name of the database that contains the view. Can include path and/or file extension. Normally, you would pass the name of the database that contains the local view. That way, you can use the local or remote version of the view depending on the Edit-Properties page setup in the Data Builder.

·       aFilterVariables – The referenceto an array that contains the definition of view filter variables.

·       cAlias – The alias to assign to the view cursor. If the parameter is empty (null, blank, .F.) the alias will be the same as the view name.

·       lAdmin – Specifies whether or not the ADMIN clause of the USE command is used. If the parameter is not empty (not null, blank, .F.), the ADMIN clause is used. Otherwise, the ADMIN clause is not used.

·       lExclusive - Specifies whether or not the EXCLUSIVE clause of the USE command is used. If the parameter is not empty (not null, blank, .F.), the EXCLUSIVE clause is used. Otherwise, the EXCLUSIVE clause is not used.

·       lNoData - Specifies whether or not the NODATA clause of the USE command is used. If the parameter is not empty (not null, blank, .F.), the NODATA clause is used. Otherwise, the NODATA clause is not used.

·       lNoRequery - Specifies whether or not the NOREQUERY clause of the USE command is used. If the parameter is not empty (not null, blank, .F.), the NOREQUERY clause is used. Otherwise, the NOREQUERY clause is not used.

·       lNoUpdate - Specifies whether or not the NOUPDATE clause of the USE command is used. If the parameter is not empty (not null, blank, .F.), the NOUPDATE clause is used. Otherwise, the NOUPDATE clause is not used.

·       lOnline - Specifies whether or not the ONLINE clause of the USE command is used. If the parameter is not empty (not null, blank, .F.), the ONLINE clause is used. Otherwise, the ONLINE clause is not used.

More:

Multilingual: Creating a Multilingual Application