OpenWorkspace - cWorkspace

Opens a registered Workspace

Type: Function

Obsolete


Return Data Type: Integer

Parameters: String sWorkspace

ParameterDescription
sWorkspaceName of the Workspace to open


Return Value

A contant (described below) indicating success or failure


Syntax
Function OpenWorkspace String sWorkspace Returns Integer

Call: Get OpenWorkspace sWorkspace to IntegerVariable


Description

Obsolete

Use OpenWorkspaceFile instead of this method.

This function works with the global Workspace list (Workspaces.ini) file. As of DataFlex revision 12.0, this file, and associated functions, are no longer used. See Workspace Changes for details.


The OpenWorkspace function opens a registered Workspace. The sWorkspace parameter represents the name of the Workspace, which must exist in the global list of registered Workspaces (Workspaces.ini). If you want to open a Workspace that is not registered, use OpenWorkspaceFile instead (or use the cApplication's DoOpenWorkspace method).
The return value is one of the following constants:

ConstantMeaning
wsWorkspaceOpenedThe Workspace was opened ok
wsWorkspaceNotFoundThe named Workspace was not found in the global list of registered Workspaces.
wsWorkspaceFileNotFoundThe file describing the Workspace(*.WS) was not found
wsDataPathEmptyThe DataPath entry was empty
wsFileListEmptyThe FileList entry was empty
wsFileListNotExistThe FileList.cfg file could not be found


If the return value is not wsWorkspaceOpened, you can retrieve a description of the error by calling OpenWorkspaceErrorMessage and passing it the error code.

In this example, the program attempts to open a Workspace named "ABC, Inc.Accounts". If it fails, it informs the user why and aborts:

Object oApplication is a cApplication

    Procedure OnCreate
        Handle hoWorkspace
        Integer eOpened
        String sError
 
        Get phoWorkspace To hoWorkspace
 
        Get OpenWorkspace of hoWorkspace "ABC, Inc.Accounts" To eOpened
        If (eOpened <> wsWorkspaceOpened) Begin
            Get OpenWorkspaceErrorMessage of hoWorkspace eOpened To sError
            Send Stop_Box sError "Error Opening Workspace"
            Abort
        End

    End_Procedure  // OnCreate

End_Object  // oApplication


Note:

See Also

DoOpenWorkspace | OpenWorkspaceFile | OpenWorkspaceErrorMessage