OpenWorkspace - cWorkspace
Opens a registered Workspace
Type: Function
Return Data Type: Integer
Parameters
| Parameter | Type | Description |
|---|---|---|
| sWorkspace | String | Name of the Workspace to open |
Syntax
Function OpenWorkspace String sWorkspace Returns Integer
Call Example
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:
| Constant | Meaning |
|---|---|
| wsWorkspaceOpened | The Workspace was opened ok |
| wsWorkspaceNotFound | The named Workspace was not found in the global list of registered Workspaces. |
| wsWorkspaceFileNotFound | The file describing the Workspace(*.WS) was not found |
| wsDataPathEmpty | The DataPath entry was empty |
| wsFileListEmpty | The FileList entry was empty |
| wsFileListNotExist | The 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
| Col 1 | Col 2 |
|---|---|
| Note: |
See Also
DoOpenWorkspace | OpenWorkspaceFile | OpenWorkspaceErrorMessage
Return Value
A contant (described below) indicating success or failure