Skip to main content
insightsoftware Documentation insightsoftware Documentation
{%article.title%}
Published:
Was this article helpful?
0 out of 0 found this helpful

API Class

The API class is the main class used to implement the Automation APIs. This section describes the Functions and Properties of the API class.

API.Connect

The API.Connect function connects to the Longview data server with specified parameters.

Parameters Description

connection

Type: string or Type: connection

This parameter is the name of a defined Connection or a Connection object.

user

Type: string

password

Type: string

group

Type: string

The API.Connect function returns the following:

Return Code Description

Long

API.ErrorCode.NoError = Successful

Otherwise, an error has been encountered

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Set LVConnection = New Longview.Connection

Dim rc As Long: rc = LVAPI.ErrorCode.NoError

' Set connection parameters With LVConnection .HostOrProxy = "MyServer"

.Identifier = "DEMO101"

.Port = "29010"

End With

' Connect

rc = LVAPI.Connect(LVConnection, "JSmith", "xxx", "Administrators")

' Handle connection return code

Select Case rc

Case LVAPI.ErrorCode.NoError: MsgBox "Connected", vbOKOnly + vbInformation, "Connection Successful"

Case LVAPI.ErrorCode.InvalidParameter: MsgBox "Invalid parameter specified" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Connection Error"

Case LVAPI.ErrorCode.ConnectServerFailed: MsgBox "Server connection failed" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Connection Error"

Case LVAPI.ErrorCode.AlreadyConnected: MsgBox "Already connected" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Already Connected"

Case Else: MsgBox "A connection error has occurred" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Connection Error"

End Select

API.Disconnect

The API.Disconnect function disconnects the user from the current Longview data server.

Parameters Description

None

 

The API.Disconnect function returns the following:

Return Code Description

Long

API.ErrorCode.NoError = Successful

Otherwise, an error has been encountered

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim rc As Long: rc = LVAPI.ErrorCode.NoError

If LVAPI.IsConnected Then     rc = LVAPI.Disconnect()

    If rc <> LVAPI.ErrorCode.NoError Then

MsgBox "Disconnect Failed" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Disconnect Failed"

    Else

MsgBox "Disconnected", vbOKOnly + vbInformation, " Successfully Disconnected"

    End If

End If

API.GetSession

The API.GetSession function retrieves information about the current session.

Parameters Description

session

Type: session

The API.GetSession function returns the following:

Return Code Description

long

API.ErrorCode.NoError = Successful

Otherwise, an error has been encountered

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim rc As Long: rc = LVAPI.ErrorCode.NoError

Dim session As New session

rc = LVAPI.GetSession(session)

Select Case rc

Case LVAPI.ErrorCode.NoError: MsgBox session.Host & " " & session.Identifier & " " &

session.UserId     

Case LVAPI.ErrorCode.NotConnected: MsgBox "Not connected" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Not Connected"

Case Else: MsgBox "Error encountered" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Error encountered"

End Select

API.IsSymbolExists

The API.IsSymbolExists function returns a boolean value indicating whether a specified symbol exists (in the dimension if the dimension name is specified).

Parameters Description

symbolName

Type: String

dimensionName (optional)

Type: String (optional)

Optional parameter specifying the name of the dimension containing symbolName.

The API.IsSymbolExists function returns the following:

Return Code Description

boolean

TRUE: Indicates symbol exists

FALSE: Indicates symbol does not exist.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API Dim result As Variant

result = LVAPI.IsSymbolExists(“ABC123”) Range("I19").Value = result

result = LVAPI.IsSymbolExists(Range("H20").Value)

Range("I20").Value = result

API.OpenConnectDialog

The API.OpenConnectDialog function simulates running the menu option: Connect. This function launches the Connection dialog.

Parameters Description

None

 

The API.OpenConnect function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Call LVAPI.OpenConnectDialog

 

If LVAPI.IsConnected Then

MsgBox "Connected", vbOKOnly + vbInformation, "Connection Successful"

 

Else

 

MsgBox "Not connected" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Not Connected"

End If

API.RetrieveChildSymbol

The API.RetrieveChildSymbol function retrieves the name of the child of a parent symbol.

Parameters Description

symbolName

Type: String

dimensionName (optional)

Type: String (optional)

Optional parameter specifying the name of the dimension containing symbolName.

The API.RetrieveChildSymbol function returns the following:

Return Code Description

boolean

TRUE: Indicates symbol exists

FALSE: Indicates symbol does not exist.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim result As Variant

result = LVAPI.IsSymbolExists(“ABC123”)

Range("I19").Value = result

 

result = LVAPI.IsSymbolExists(Range("H20").Value)

Range("I20").Value = result

API.RetrieveChildSymbolToWorksheet

The API.RetrieveChildSymbolToWorksheet function retrieves the name of the child of a parent symbol to a worksheet cell.

Parameters Description

symbolname

Type: String

Specifies the parent symbol whose child you wish to retrieve.

nthChild (optional)

Type: Long (default = 1)

Optional parameter that represents the numeric position of the child symbol relative to the other child symbols at the same level in the hierarchy. If you do not specify a value for number, a default value of 1 is used.

worksheetName (optional)

Type: String

Optional string representing the name of the worksheet to place the results. If the worksheet does not exist, it will be created. If the worksheetName parameter is not specified, the current worksheet will be used.

cell (optional)

Type: String

Optional string representing the cell location to begin the symbol query. If the cell parameter is not specified, the default cell location A1 will be used.

Example

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

LVAPI.RetrieveChildSymbolToWorksheet "AYR2020", 2, "C1"

API.RetrieveDimDesc

The API.RetrieveDimDesc function retrieves the description of a dimension.

Parameters Description

dimensionName

Type: String

Specifies the name or number of the dimension.

The API.RetrieveDimDesc function returns the following:

Return Code Description

String

Returns the description of the dimension specified.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim result As Variant

   

' Dimension description

result = LVAPI.RetrieveDimDesc("COST_CENTRES") Range("G2").Value = result

API.RetrieveDimDescToWorksheet

The API.RetrieveDimDescToWorksheet function retrieves the description of a dimension to a worksheet cell.

Parameters Description

dimensionName

Type: String

Specifies the name or number of the dimension.

worksheetName

(optional)

Type: String

Optional string representing the name of the worksheet to place the results. If the worksheet does not exist, it will be created. If the worksheetName parameter is not specified, the current worksheet will be used.

cell(optional)

Type: StringOptional string representing the cell location to begin the symbol query. If the cell parameter is not specified, the default cell location A1 will be used.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

LVAPI.RetrieveDimDescToWorksheet "ENTITIES", "H1"

API.RetrieveDimRoots

The API.RetrieveDimRoots function retrieves the root symbols of a dimension.

Parameters Description

dimensionName

Type: String

Specifies the name or number of the dimension.

The API.RetrieveDimRoots function returns the following:

Return Code Description

String()

Returns the root symbols of the specified dimension.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim result As Variant

Dim x As Long

   

Dim rootNames() As String

rootNames = LVAPI.RetrieveDimRoots("ENTITIES")

 

For x = 0 To UBound(rootNames)

Range("A7").Offset(x).Value = rootNames(x)

Next x

API.RetrieveDimRootsToWorksheet

The API.RetrieveDimRootsToWorksheet function retrieves the root symbols of a dimension to a worksheet.

Parameters Description

dimensionName

Type: String

Specifies the name of the dimension.

worksheetName (optional)

Type: String

Optional string representing the name of the worksheet to place the results. If the worksheet does not exist, it will be created. If the worksheetName parameter is not specified, the current worksheet will be used.

cell (optional)

Type: String

Optional string representing the cell location to begin the symbol query. If the cell parameter is not specified, the default cell location A1 will be used.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim result As Variant

 

' Dimension roots

LVAPI.RetrieveDimRootsToWorksheet "ENTITIES", "F1", "Retrieve DimRoots to WS"

API.RetrieveSymbolInfo

The API.RetrieveSymbolInfo function retrieves various metadata information for a specified symbol. Metadata information includes information such as: the description, balance type, number of children, weight.

Parameters Description

dimensionName

Type: String

Specifies the name of the dimension.

symbolName

Type: String

Specifies the symbol whose information you wish to retrieve.

root

(optional)

Type: String

Optional parameter for the name of the root symbol of the hierarchy containing the symbolname. Specify a root symbol if the symbol name specified for symbolName belongs to multiple parent symbols.

The API.RetrieveSymbolInfo function returns the following:

Return Code Description

Symbol

Contains the symbol information for the specified symbol.

Example:

im LVAPI As Longview.API

Set LVAPI = New Longview.API

 

Dim symbol As Longview.symbol

 

Set symbol= LVAPI.RetrieveSymbolInfo("TIMEPERIODS", "A2020")

Range("I8").Value = symbol.Name

Range("J8").Value = symbol.Description

Range("K8").Value = symbol.BalanceType

Range("L8").Value = symbol.TotalDescendants

Range("M8").Value = symbol.Weight

Range("N8").Value = symbol.SymbolType

API.RetrieveSymbolList

The API.RetrieveSymbolList function retrieves a list of symbols for a specified dimension.

Parameters Description

dimensionName

Type: String

Specifies the name of the dimension.

The API.RetrieveSymbolList function returns the following:

Return Code Description

String()

Returns a list of symbol names for the specified dimension.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim result As Variant

 

Dim symbols() As String symbols = LVAPI.RetrieveSymbolList("TIMEPERIODS")

Dim x As Long

For x = 0 To UBound(symbols)

        Range("U5").Offset(x).Value = symbols(x)

Next x

API.RetrieveSymbolListToWorksheet

The API.RetrieveSymbolListToWorksheet function retrieves a list of symbols for a specified dimension to a worksheet.

ParametUers Description

dimensionName

Type: String

Specifies the name of the dimension

worksheetName

(optional)

Type: String

Optional string representing the name of the worksheet to place the results. If the worksheet does not exist, it will be created. If the worksheetName parameter is not specified, the current worksheet will be used.

cell (optional)

Type: String

Optional string representing the cell location to begin the symbol query. If the cell parameter is not specified, the default cell location A1 will be used.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

LVAPI.RetrieveSymbolListToWorksheet "ENTITIES", "F1", "ENTITY Symbols"

API.RunRefreshWorkbook

The API.RunRefreshWorkbook function simulates running the menu option: Refresh Workbook >By Cycling Through All Worksheets.

This function refreshes all LV* functions in the workbook. The system refreshes the workbook by making a call to the data server for each worksheet in the workbook.

Parameters Description

workbook (optional)

Type: workbook (optional)

If workbook is not specified, then the active workbook will be refreshed.

The workbook specified becomes the active workbook.

The API.RunRefreshWorkbook function returns the following:

Return Code Notes

None

 

Example:

Dim LVAPI As Longview.API

Dim WBExampleas Workbook

Set WBExample = Workbooks("Example1.xlsx")

 

'Refreshes the currently-active

workbook Call

LVAPI.RunRefreshWorkbook

 

'Refreshes the currently-active workbook

Call LVAPI.RunRefreshWorkbook(ActiveWorkbook)

 

'Refreshes the workbook containing this code

Call LVAPI.RunRefreshWorkbook(ThisWorkbook)

 

'Refreshes the workbook as set in variable WBExample

Call LVAPI.RunRefreshWorkbook(WBExample)

 

'Refreshes workbook “Example2.xlsx”

Call LVAPI.RunRefreshWorkbook(Workbooks("Example2.xlsx")

API.RunRefreshWorkbookSingleRetrieval

The API.RunRefreshWorkbookSingleRetrieval function simulates running the menu option: Refresh Workbook >With a Single Database Retrieval.

This function refreshes all LV* functions in the workbook. The system refreshes the workbook by making a single call to the data server for the entire workbook.

Parameters Description

workbook (optional)

Type: workbook (optional)

If workbook is not specified, then the active workbook will be refreshed. The workbook specified becomes the active workbook.

The API.RunRefreshWorkbookSingleRetrieval function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim WBExampleas Workbook

Set WBExample = Workbooks("Example1.xlsx")

 

'Refreshes the currently-active workbook

Call LVAPI.RunRefreshWorkbookSingleRetrieval

 

'Refreshes the currently-active workbook

Call LVAPI.RunRefreshWorkbookSingleRetrieval(ActiveWorkbook)

 

'Refreshes the workbook containing this code

Call LVAPI.RunRefreshWorkbookSingleRetrieval(ThisWorkbook)

 

'Refreshes the workbook as set in variable WBExample

Call LVAPI.RunRefreshWorkbookSingleRetrieval(WBExample)

 

'Refreshes workbook “Example2.xlsx”

Call LVAPI.RunRefreshWorkbookSingleRetrieval(Workbooks("Example2.xlsx")

API.RunRefreshWorksheet

The API.RunRefreshWorksheet function simulates running the menu option: Refresh Worksheet. This function refreshes all LV* functions in the requested worksheet.

Parameters Description

worksheet (optional)

Type: worksheet (optional)

If worksheet is not specified, then the active worksheet will be refreshed. The worksheet specified becomes the active worksheet in the active workbook.

The API.RunRefreshWorksheet function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

'Refresh active sheet by explicitly passing active sheet Call

LVAPI.RunRefreshWorksheet(ActiveSheet)

 

'Refresh active sheet by not specifying worksheet

Call LVAPI.RunRefreshWorksheet()

 

'Refresh specifically named worksheet

Call LVAPI.RunRefreshWorksheet(Worksheets(“Sheet1”))

 

'Refresh a specific worksheet

Dim WSTest as Worksheet

Set WSTest = Worksheets(“NameOfAWorksheet”)

Call LVAPI.RunRefreshWorksheet(WSTest)

API.RunSubmitWorkbook

The API.RunSubmitWorkbook function simulates running the menu option:

Submit > Submit Workbook.

This function invokes the following steps, in order:

  1. Applies a lock as defined by each LVLOCK function in the active workbook.
  2. Submits data for each LVSUBMIT function in the active workbook.
  3. Releases the lock defined by each LVLOCK function in the active workbook.
Parameters Description

workbook

Type: workbook (optional)

If workbook is not specified, then the active workbook will be refreshed. The workbook specified becomes the active workbook.

The API.RunSubmitWorkbook function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim WBExampleas Workbook

Set WBExample = Workbooks("Example1.xlsx")

 

'Refreshes the currently-active

workbook Call

LVAPI.RunSubmitWorkbook

 

'Refreshes the currently-active workbook

Call LVAPI.RunSubmitWorkbook(ActiveWorkbook)

 

'Refreshes the workbook containing this code

Call LVAPI.RunSubmitWorkbook(ThisWorkbook)

 

'Refreshes the workbook as set in variable WBExample

Call LVAPI.RunSubmitWorkbook(WBExample)

 

'Refreshes workbook “Example2.xlsx”

Call LVAPI.RunSubmitWorkbook(Workbooks("Example2.xlsx")

API.RunSubmitWorksheet

The API.RunSubmitWorksheet function simulates running the menu option: Submit > Submit Worksheet.

This function invokes the following steps, in order:

  1. Applies a lock as defined by each LVLOCK function in the specified worksheet.
  2. Submits data for each LVSUBMIT function in the specified worksheet.
  3. Releases the lock defined by each LVLOCK function in the specified worksheet.
Parameters Description

worksheet (optional)

Type: worksheet (optional)

If worksheet is not specified, then the active worksheet will be refreshed. The worksheet specified becomes the active worksheet in the active workbook.

The API.RunSubmitWorksheet function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

 

'Submit active sheet by explicitly passing active sheet

Call LVAPI.RunSubmitWorksheet(ActiveSheet)

 

'Submit active sheet by not specifying worksheet

Call LVAPI.RunSubmitWorksheet()

 

'Submit specifically named worksheet

Call LVAPI.RunSubmitWorksheet (Worksheets(“Sheet1”))

 

'Submit a specific worksheet

Dim WSTest as Worksheet

Set WSTest = Worksheets(“NameOfAWorksheet”)

Call LVAPI.RunSubmitWorksheet(WSTest)

API.RunWorkbookApplyLocks

The API.RunWorkbookApplyLocks function simulates running the menu option: Submit >Manual Submission >Workbook >Apply Locks. This function applies a lock as defined by each LVLOCK function in the active workbook.

Parameters Description

workbook (optional)

Type: workbook (optional)

If workbook is not specified, then the active workbook will be refreshed. The workbook specified becomes the active workbook.

The API.RunWorkbookApplyLocks function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim WBExampleas Workbook

Set WBExample = Workbooks("Example1.xlsx")

'Refreshes the currently-active workbook

Call LVAPI.RunWorkbookApplyLocks

 

'Refreshes the currently-active workbook

Call LVAPI.RunWorkbookApplyLocks(ActiveWorkbook)

 

'Refreshes the workbook containing this code

Call LVAPI.RunWorkbookApplyLocks(ThisWorkbook)

 

'Refreshes the workbook as set in variable WBExample

Call LVAPI.RunWorkbookApplyLocks(WBExample)

 

'Refreshes workbook “Example2.xlsx”

Call LVAPI.RunWorkbookApplyLocks(Workbooks("Example2.xlsx")

API.RunWorkbookReleaseLocks

The API.RunWorkbookReleaseLocks function simulates running the menu option: Submit > Manual Submission > Workbook > Release Locks. This function releases the lock defined by each LVLOCK function in the active workbook.

Parameters Description

workbook (optional)

Type: workbook (optional)

If workbook is not specified, then the active workbook will be refreshed. The workbook specified becomes the active workbook

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim WBExampleas Workbook

Set WBExample = Workbooks("Example1.xlsx")

'Refreshes the currently-active workbook

Call LVAPI.RunWorkbookReleaseLocks

'Refreshes the currently-active workbook

Call LVAPI.RunWorkbookReleaseLocks(ActiveWorkbook)

'Refreshes the workbook containing this code

Call LVAPI.RunWorkbookReleaseLocks(ThisWorkbook)

'Refreshes the workbook as set in variable WBExample

Call LVAPI.RunWorkbookReleaseLocks(WBExample)

'Refreshes workbook “Example2.xlsx”

Call LVAPI.RunWorkbookReleaseLocks(Workbooks("Example2.xlsx")

API.RunWorkbookSubmitData

The API.RunWorkbookSubmitData function simulates running the menu option: Submit >Manual Submission >Workbook >Submit Data. This function submits data for each LVSUBMIT function in the active workbook.

Parameters Description

workbook (optional)

Type: workbook (optional)

If workbook is not specified, then the active workbook will be refreshed. The workbook specified becomes the active workbook

The API.RunWorkbookSubmitData function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Call LVAPI.RunWorkbookSubmitData(ThisWorkbook)

API.RunWorksheetApplyLocks

The API.RunWorksheetApplyLocks function simulates running the menu option: Submit >Manual Submission >Worksheet >Apply Locks. This function applies a lock as defined by each LVLOCK function in the specified worksheet.

Parameters Description

worksheet (optional)

Type: worksheet (optional)

If worksheet is not specified, then the active worksheet will be refreshed. The worksheet specified becomes the active worksheet in the active workbook.

The API.RunWorksheetApplyLocks function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

 

'Apply locks on active sheet by explicitly passing active sheet

Call LVAPI.RunWorksheetApplyLocks (ActiveSheet)

 

'Apply locks on active sheet by not specifying worksheet

Call LVAPI.RunWorksheetApplyLocks ()

 

'Apply locks on specifically named worksheet

Call LVAPI.RunWorksheetApplyLocks (Worksheets(“Sheet1”))

 

'Apply locks on a specific worksheet

Dim WSTest as Worksheet

Set WSTest = Worksheets(“NameOfAWorksheet”)

Call LVAPI.RunWorksheetApplyLocks(WSTest)

API.RunWorksheetReleaseLocks

The API.RunWorksheetReleaseLocks function simulates running the menu option: Submit >Manual Submission > Worksheet >Release Locks. This function releases the lock defined by each LVLOCK function in the specified worksheet.

Parameters Description

worksheet (optional)

Type: worksheet (optional)

If worksheet is not specified, then the active worksheet will be refreshed. The worksheet specified becomes the active worksheet in the active workbook.

The API.RunWorksheetReleaseLocks function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

 

'Submit active sheet by explicitly passing active

sheet Call LVAPI.RunWorksheetReleaseLocks (ActiveSheet)

 

'Submit active sheet by not specifying worksheet

Call LVAPI.RunWorksheetReleaseLocks ()

 

'Submit specifically named worksheet

Call LVAPI.RunWorksheetReleaseLocks (Worksheets(“Sheet1”))

 

'Submit a specific worksheet

Dim WSTest as Worksheet

Set WSTest = Worksheets(“NameOfAWorksheet”)

Call LVAPI.RunWorksheetReleaseLocks (WSTest)

API.RunWorksheetSubmitData

The API.RunWorksheetSubmitData function simulates running the menu option: Submit >Manual Submission >Worksheet >Submit Data. This function submits data for each LVSUBMIT function in the specified worksheet.

Parameters Description

worksheet (optional)

Type: worksheet (optional)

If worksheet is not specified, then the active worksheet will be refreshed. The worksheet specified becomes the active worksheet in the active workbook.

The API.RunWorksheetSubmitData function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Call LVAPI.RunWorksheetSubmitData(ActiveSheet)

 

'Submit active sheet by explicitly passing active sheet

Call LVAPI.RunWorksheetSubmitData (ActiveSheet)

 

'Submit active sheet by not specifying worksheet

Call LVAPI.RunWorksheetSubmitData ()

 

'Submit specifically named worksheet

Call LVAPI.RunWorksheetSubmitData (Worksheets(“Sheet1”))

 

'Submit a specific worksheet

Dim WSTest as Worksheet

Set WSTest = Worksheets(“NameOfAWorksheet”)

Call LVAPI.RunWorksheetSubmitData (WSTest)

API Properties

The following table lists the properties of the API class:

Name Type Description

ErrorCode

object

ErrorCode represents common error codes that may be returned by various functions.

IsConnected

boolean

IsConnected returns a Boolean value indicating whether the user is currently connected or not.

Version

string

Version is a string indicating the version of the Longview Add-In for Office.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim rc As Long: rc = LVAPI.ErrorCode.NoError

 

MsgBox "Longview Version " & LVAPI.Version, vbOKOnly + vbInformation, "Version Information"

   

If LVAPI.IsConnected Then  

      MsgBox "Connected", vbOKOnly + vbInformation, "Connection Successful"

Else 

MsgBox "Not connected" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Not Connected"   

End If

Published:

API Class

The API class is the main class used to implement the Automation APIs. This section describes the Functions and Properties of the API class.

API.Connect

The API.Connect function connects to the Longview data server with specified parameters.

Parameters Description

connection

Type: string or Type: connection

This parameter is the name of a defined Connection or a Connection object.

user

Type: string

password

Type: string

group

Type: string

The API.Connect function returns the following:

Return Code Description

Long

API.ErrorCode.NoError = Successful

Otherwise, an error has been encountered

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Set LVConnection = New Longview.Connection

Dim rc As Long: rc = LVAPI.ErrorCode.NoError

' Set connection parameters With LVConnection .HostOrProxy = "MyServer"

.Identifier = "DEMO101"

.Port = "29010"

End With

' Connect

rc = LVAPI.Connect(LVConnection, "JSmith", "xxx", "Administrators")

' Handle connection return code

Select Case rc

Case LVAPI.ErrorCode.NoError: MsgBox "Connected", vbOKOnly + vbInformation, "Connection Successful"

Case LVAPI.ErrorCode.InvalidParameter: MsgBox "Invalid parameter specified" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Connection Error"

Case LVAPI.ErrorCode.ConnectServerFailed: MsgBox "Server connection failed" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Connection Error"

Case LVAPI.ErrorCode.AlreadyConnected: MsgBox "Already connected" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Already Connected"

Case Else: MsgBox "A connection error has occurred" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Connection Error"

End Select

API.Disconnect

The API.Disconnect function disconnects the user from the current Longview data server.

Parameters Description

None

 

The API.Disconnect function returns the following:

Return Code Description

Long

API.ErrorCode.NoError = Successful

Otherwise, an error has been encountered

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim rc As Long: rc = LVAPI.ErrorCode.NoError

If LVAPI.IsConnected Then     rc = LVAPI.Disconnect()

    If rc <> LVAPI.ErrorCode.NoError Then

MsgBox "Disconnect Failed" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Disconnect Failed"

    Else

MsgBox "Disconnected", vbOKOnly + vbInformation, " Successfully Disconnected"

    End If

End If

API.GetSession

The API.GetSession function retrieves information about the current session.

Parameters Description

session

Type: session

The API.GetSession function returns the following:

Return Code Description

long

API.ErrorCode.NoError = Successful

Otherwise, an error has been encountered

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim rc As Long: rc = LVAPI.ErrorCode.NoError

Dim session As New session

rc = LVAPI.GetSession(session)

Select Case rc

Case LVAPI.ErrorCode.NoError: MsgBox session.Host & " " & session.Identifier & " " &

session.UserId     

Case LVAPI.ErrorCode.NotConnected: MsgBox "Not connected" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Not Connected"

Case Else: MsgBox "Error encountered" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Error encountered"

End Select

API.IsSymbolExists

The API.IsSymbolExists function returns a boolean value indicating whether a specified symbol exists (in the dimension if the dimension name is specified).

Parameters Description

symbolName

Type: String

dimensionName (optional)

Type: String (optional)

Optional parameter specifying the name of the dimension containing symbolName.

The API.IsSymbolExists function returns the following:

Return Code Description

boolean

TRUE: Indicates symbol exists

FALSE: Indicates symbol does not exist.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API Dim result As Variant

result = LVAPI.IsSymbolExists(“ABC123”) Range("I19").Value = result

result = LVAPI.IsSymbolExists(Range("H20").Value)

Range("I20").Value = result

API.OpenConnectDialog

The API.OpenConnectDialog function simulates running the menu option: Connect. This function launches the Connection dialog.

Parameters Description

None

 

The API.OpenConnect function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Call LVAPI.OpenConnectDialog

 

If LVAPI.IsConnected Then

MsgBox "Connected", vbOKOnly + vbInformation, "Connection Successful"

 

Else

 

MsgBox "Not connected" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Not Connected"

End If

API.RetrieveChildSymbol

The API.RetrieveChildSymbol function retrieves the name of the child of a parent symbol.

Parameters Description

symbolName

Type: String

dimensionName (optional)

Type: String (optional)

Optional parameter specifying the name of the dimension containing symbolName.

The API.RetrieveChildSymbol function returns the following:

Return Code Description

boolean

TRUE: Indicates symbol exists

FALSE: Indicates symbol does not exist.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim result As Variant

result = LVAPI.IsSymbolExists(“ABC123”)

Range("I19").Value = result

 

result = LVAPI.IsSymbolExists(Range("H20").Value)

Range("I20").Value = result

API.RetrieveChildSymbolToWorksheet

The API.RetrieveChildSymbolToWorksheet function retrieves the name of the child of a parent symbol to a worksheet cell.

Parameters Description

symbolname

Type: String

Specifies the parent symbol whose child you wish to retrieve.

nthChild (optional)

Type: Long (default = 1)

Optional parameter that represents the numeric position of the child symbol relative to the other child symbols at the same level in the hierarchy. If you do not specify a value for number, a default value of 1 is used.

worksheetName (optional)

Type: String

Optional string representing the name of the worksheet to place the results. If the worksheet does not exist, it will be created. If the worksheetName parameter is not specified, the current worksheet will be used.

cell (optional)

Type: String

Optional string representing the cell location to begin the symbol query. If the cell parameter is not specified, the default cell location A1 will be used.

Example

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

LVAPI.RetrieveChildSymbolToWorksheet "AYR2020", 2, "C1"

API.RetrieveDimDesc

The API.RetrieveDimDesc function retrieves the description of a dimension.

Parameters Description

dimensionName

Type: String

Specifies the name or number of the dimension.

The API.RetrieveDimDesc function returns the following:

Return Code Description

String

Returns the description of the dimension specified.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim result As Variant

   

' Dimension description

result = LVAPI.RetrieveDimDesc("COST_CENTRES") Range("G2").Value = result

API.RetrieveDimDescToWorksheet

The API.RetrieveDimDescToWorksheet function retrieves the description of a dimension to a worksheet cell.

Parameters Description

dimensionName

Type: String

Specifies the name or number of the dimension.

worksheetName

(optional)

Type: String

Optional string representing the name of the worksheet to place the results. If the worksheet does not exist, it will be created. If the worksheetName parameter is not specified, the current worksheet will be used.

cell(optional)

Type: StringOptional string representing the cell location to begin the symbol query. If the cell parameter is not specified, the default cell location A1 will be used.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

LVAPI.RetrieveDimDescToWorksheet "ENTITIES", "H1"

API.RetrieveDimRoots

The API.RetrieveDimRoots function retrieves the root symbols of a dimension.

Parameters Description

dimensionName

Type: String

Specifies the name or number of the dimension.

The API.RetrieveDimRoots function returns the following:

Return Code Description

String()

Returns the root symbols of the specified dimension.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim result As Variant

Dim x As Long

   

Dim rootNames() As String

rootNames = LVAPI.RetrieveDimRoots("ENTITIES")

 

For x = 0 To UBound(rootNames)

Range("A7").Offset(x).Value = rootNames(x)

Next x

API.RetrieveDimRootsToWorksheet

The API.RetrieveDimRootsToWorksheet function retrieves the root symbols of a dimension to a worksheet.

Parameters Description

dimensionName

Type: String

Specifies the name of the dimension.

worksheetName (optional)

Type: String

Optional string representing the name of the worksheet to place the results. If the worksheet does not exist, it will be created. If the worksheetName parameter is not specified, the current worksheet will be used.

cell (optional)

Type: String

Optional string representing the cell location to begin the symbol query. If the cell parameter is not specified, the default cell location A1 will be used.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim result As Variant

 

' Dimension roots

LVAPI.RetrieveDimRootsToWorksheet "ENTITIES", "F1", "Retrieve DimRoots to WS"

API.RetrieveSymbolInfo

The API.RetrieveSymbolInfo function retrieves various metadata information for a specified symbol. Metadata information includes information such as: the description, balance type, number of children, weight.

Parameters Description

dimensionName

Type: String

Specifies the name of the dimension.

symbolName

Type: String

Specifies the symbol whose information you wish to retrieve.

root

(optional)

Type: String

Optional parameter for the name of the root symbol of the hierarchy containing the symbolname. Specify a root symbol if the symbol name specified for symbolName belongs to multiple parent symbols.

The API.RetrieveSymbolInfo function returns the following:

Return Code Description

Symbol

Contains the symbol information for the specified symbol.

Example:

im LVAPI As Longview.API

Set LVAPI = New Longview.API

 

Dim symbol As Longview.symbol

 

Set symbol= LVAPI.RetrieveSymbolInfo("TIMEPERIODS", "A2020")

Range("I8").Value = symbol.Name

Range("J8").Value = symbol.Description

Range("K8").Value = symbol.BalanceType

Range("L8").Value = symbol.TotalDescendants

Range("M8").Value = symbol.Weight

Range("N8").Value = symbol.SymbolType

API.RetrieveSymbolList

The API.RetrieveSymbolList function retrieves a list of symbols for a specified dimension.

Parameters Description

dimensionName

Type: String

Specifies the name of the dimension.

The API.RetrieveSymbolList function returns the following:

Return Code Description

String()

Returns a list of symbol names for the specified dimension.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim result As Variant

 

Dim symbols() As String symbols = LVAPI.RetrieveSymbolList("TIMEPERIODS")

Dim x As Long

For x = 0 To UBound(symbols)

        Range("U5").Offset(x).Value = symbols(x)

Next x

API.RetrieveSymbolListToWorksheet

The API.RetrieveSymbolListToWorksheet function retrieves a list of symbols for a specified dimension to a worksheet.

ParametUers Description

dimensionName

Type: String

Specifies the name of the dimension

worksheetName

(optional)

Type: String

Optional string representing the name of the worksheet to place the results. If the worksheet does not exist, it will be created. If the worksheetName parameter is not specified, the current worksheet will be used.

cell (optional)

Type: String

Optional string representing the cell location to begin the symbol query. If the cell parameter is not specified, the default cell location A1 will be used.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

LVAPI.RetrieveSymbolListToWorksheet "ENTITIES", "F1", "ENTITY Symbols"

API.RunRefreshWorkbook

The API.RunRefreshWorkbook function simulates running the menu option: Refresh Workbook >By Cycling Through All Worksheets.

This function refreshes all LV* functions in the workbook. The system refreshes the workbook by making a call to the data server for each worksheet in the workbook.

Parameters Description

workbook (optional)

Type: workbook (optional)

If workbook is not specified, then the active workbook will be refreshed.

The workbook specified becomes the active workbook.

The API.RunRefreshWorkbook function returns the following:

Return Code Notes

None

 

Example:

Dim LVAPI As Longview.API

Dim WBExampleas Workbook

Set WBExample = Workbooks("Example1.xlsx")

 

'Refreshes the currently-active

workbook Call

LVAPI.RunRefreshWorkbook

 

'Refreshes the currently-active workbook

Call LVAPI.RunRefreshWorkbook(ActiveWorkbook)

 

'Refreshes the workbook containing this code

Call LVAPI.RunRefreshWorkbook(ThisWorkbook)

 

'Refreshes the workbook as set in variable WBExample

Call LVAPI.RunRefreshWorkbook(WBExample)

 

'Refreshes workbook “Example2.xlsx”

Call LVAPI.RunRefreshWorkbook(Workbooks("Example2.xlsx")

API.RunRefreshWorkbookSingleRetrieval

The API.RunRefreshWorkbookSingleRetrieval function simulates running the menu option: Refresh Workbook >With a Single Database Retrieval.

This function refreshes all LV* functions in the workbook. The system refreshes the workbook by making a single call to the data server for the entire workbook.

Parameters Description

workbook (optional)

Type: workbook (optional)

If workbook is not specified, then the active workbook will be refreshed. The workbook specified becomes the active workbook.

The API.RunRefreshWorkbookSingleRetrieval function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim WBExampleas Workbook

Set WBExample = Workbooks("Example1.xlsx")

 

'Refreshes the currently-active workbook

Call LVAPI.RunRefreshWorkbookSingleRetrieval

 

'Refreshes the currently-active workbook

Call LVAPI.RunRefreshWorkbookSingleRetrieval(ActiveWorkbook)

 

'Refreshes the workbook containing this code

Call LVAPI.RunRefreshWorkbookSingleRetrieval(ThisWorkbook)

 

'Refreshes the workbook as set in variable WBExample

Call LVAPI.RunRefreshWorkbookSingleRetrieval(WBExample)

 

'Refreshes workbook “Example2.xlsx”

Call LVAPI.RunRefreshWorkbookSingleRetrieval(Workbooks("Example2.xlsx")

API.RunRefreshWorksheet

The API.RunRefreshWorksheet function simulates running the menu option: Refresh Worksheet. This function refreshes all LV* functions in the requested worksheet.

Parameters Description

worksheet (optional)

Type: worksheet (optional)

If worksheet is not specified, then the active worksheet will be refreshed. The worksheet specified becomes the active worksheet in the active workbook.

The API.RunRefreshWorksheet function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

'Refresh active sheet by explicitly passing active sheet Call

LVAPI.RunRefreshWorksheet(ActiveSheet)

 

'Refresh active sheet by not specifying worksheet

Call LVAPI.RunRefreshWorksheet()

 

'Refresh specifically named worksheet

Call LVAPI.RunRefreshWorksheet(Worksheets(“Sheet1”))

 

'Refresh a specific worksheet

Dim WSTest as Worksheet

Set WSTest = Worksheets(“NameOfAWorksheet”)

Call LVAPI.RunRefreshWorksheet(WSTest)

API.RunSubmitWorkbook

The API.RunSubmitWorkbook function simulates running the menu option:

Submit > Submit Workbook.

This function invokes the following steps, in order:

  1. Applies a lock as defined by each LVLOCK function in the active workbook.
  2. Submits data for each LVSUBMIT function in the active workbook.
  3. Releases the lock defined by each LVLOCK function in the active workbook.
Parameters Description

workbook

Type: workbook (optional)

If workbook is not specified, then the active workbook will be refreshed. The workbook specified becomes the active workbook.

The API.RunSubmitWorkbook function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim WBExampleas Workbook

Set WBExample = Workbooks("Example1.xlsx")

 

'Refreshes the currently-active

workbook Call

LVAPI.RunSubmitWorkbook

 

'Refreshes the currently-active workbook

Call LVAPI.RunSubmitWorkbook(ActiveWorkbook)

 

'Refreshes the workbook containing this code

Call LVAPI.RunSubmitWorkbook(ThisWorkbook)

 

'Refreshes the workbook as set in variable WBExample

Call LVAPI.RunSubmitWorkbook(WBExample)

 

'Refreshes workbook “Example2.xlsx”

Call LVAPI.RunSubmitWorkbook(Workbooks("Example2.xlsx")

API.RunSubmitWorksheet

The API.RunSubmitWorksheet function simulates running the menu option: Submit > Submit Worksheet.

This function invokes the following steps, in order:

  1. Applies a lock as defined by each LVLOCK function in the specified worksheet.
  2. Submits data for each LVSUBMIT function in the specified worksheet.
  3. Releases the lock defined by each LVLOCK function in the specified worksheet.
Parameters Description

worksheet (optional)

Type: worksheet (optional)

If worksheet is not specified, then the active worksheet will be refreshed. The worksheet specified becomes the active worksheet in the active workbook.

The API.RunSubmitWorksheet function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

 

'Submit active sheet by explicitly passing active sheet

Call LVAPI.RunSubmitWorksheet(ActiveSheet)

 

'Submit active sheet by not specifying worksheet

Call LVAPI.RunSubmitWorksheet()

 

'Submit specifically named worksheet

Call LVAPI.RunSubmitWorksheet (Worksheets(“Sheet1”))

 

'Submit a specific worksheet

Dim WSTest as Worksheet

Set WSTest = Worksheets(“NameOfAWorksheet”)

Call LVAPI.RunSubmitWorksheet(WSTest)

API.RunWorkbookApplyLocks

The API.RunWorkbookApplyLocks function simulates running the menu option: Submit >Manual Submission >Workbook >Apply Locks. This function applies a lock as defined by each LVLOCK function in the active workbook.

Parameters Description

workbook (optional)

Type: workbook (optional)

If workbook is not specified, then the active workbook will be refreshed. The workbook specified becomes the active workbook.

The API.RunWorkbookApplyLocks function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim WBExampleas Workbook

Set WBExample = Workbooks("Example1.xlsx")

'Refreshes the currently-active workbook

Call LVAPI.RunWorkbookApplyLocks

 

'Refreshes the currently-active workbook

Call LVAPI.RunWorkbookApplyLocks(ActiveWorkbook)

 

'Refreshes the workbook containing this code

Call LVAPI.RunWorkbookApplyLocks(ThisWorkbook)

 

'Refreshes the workbook as set in variable WBExample

Call LVAPI.RunWorkbookApplyLocks(WBExample)

 

'Refreshes workbook “Example2.xlsx”

Call LVAPI.RunWorkbookApplyLocks(Workbooks("Example2.xlsx")

API.RunWorkbookReleaseLocks

The API.RunWorkbookReleaseLocks function simulates running the menu option: Submit > Manual Submission > Workbook > Release Locks. This function releases the lock defined by each LVLOCK function in the active workbook.

Parameters Description

workbook (optional)

Type: workbook (optional)

If workbook is not specified, then the active workbook will be refreshed. The workbook specified becomes the active workbook

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim WBExampleas Workbook

Set WBExample = Workbooks("Example1.xlsx")

'Refreshes the currently-active workbook

Call LVAPI.RunWorkbookReleaseLocks

'Refreshes the currently-active workbook

Call LVAPI.RunWorkbookReleaseLocks(ActiveWorkbook)

'Refreshes the workbook containing this code

Call LVAPI.RunWorkbookReleaseLocks(ThisWorkbook)

'Refreshes the workbook as set in variable WBExample

Call LVAPI.RunWorkbookReleaseLocks(WBExample)

'Refreshes workbook “Example2.xlsx”

Call LVAPI.RunWorkbookReleaseLocks(Workbooks("Example2.xlsx")

API.RunWorkbookSubmitData

The API.RunWorkbookSubmitData function simulates running the menu option: Submit >Manual Submission >Workbook >Submit Data. This function submits data for each LVSUBMIT function in the active workbook.

Parameters Description

workbook (optional)

Type: workbook (optional)

If workbook is not specified, then the active workbook will be refreshed. The workbook specified becomes the active workbook

The API.RunWorkbookSubmitData function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Call LVAPI.RunWorkbookSubmitData(ThisWorkbook)

API.RunWorksheetApplyLocks

The API.RunWorksheetApplyLocks function simulates running the menu option: Submit >Manual Submission >Worksheet >Apply Locks. This function applies a lock as defined by each LVLOCK function in the specified worksheet.

Parameters Description

worksheet (optional)

Type: worksheet (optional)

If worksheet is not specified, then the active worksheet will be refreshed. The worksheet specified becomes the active worksheet in the active workbook.

The API.RunWorksheetApplyLocks function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

 

'Apply locks on active sheet by explicitly passing active sheet

Call LVAPI.RunWorksheetApplyLocks (ActiveSheet)

 

'Apply locks on active sheet by not specifying worksheet

Call LVAPI.RunWorksheetApplyLocks ()

 

'Apply locks on specifically named worksheet

Call LVAPI.RunWorksheetApplyLocks (Worksheets(“Sheet1”))

 

'Apply locks on a specific worksheet

Dim WSTest as Worksheet

Set WSTest = Worksheets(“NameOfAWorksheet”)

Call LVAPI.RunWorksheetApplyLocks(WSTest)

API.RunWorksheetReleaseLocks

The API.RunWorksheetReleaseLocks function simulates running the menu option: Submit >Manual Submission > Worksheet >Release Locks. This function releases the lock defined by each LVLOCK function in the specified worksheet.

Parameters Description

worksheet (optional)

Type: worksheet (optional)

If worksheet is not specified, then the active worksheet will be refreshed. The worksheet specified becomes the active worksheet in the active workbook.

The API.RunWorksheetReleaseLocks function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

 

'Submit active sheet by explicitly passing active

sheet Call LVAPI.RunWorksheetReleaseLocks (ActiveSheet)

 

'Submit active sheet by not specifying worksheet

Call LVAPI.RunWorksheetReleaseLocks ()

 

'Submit specifically named worksheet

Call LVAPI.RunWorksheetReleaseLocks (Worksheets(“Sheet1”))

 

'Submit a specific worksheet

Dim WSTest as Worksheet

Set WSTest = Worksheets(“NameOfAWorksheet”)

Call LVAPI.RunWorksheetReleaseLocks (WSTest)

API.RunWorksheetSubmitData

The API.RunWorksheetSubmitData function simulates running the menu option: Submit >Manual Submission >Worksheet >Submit Data. This function submits data for each LVSUBMIT function in the specified worksheet.

Parameters Description

worksheet (optional)

Type: worksheet (optional)

If worksheet is not specified, then the active worksheet will be refreshed. The worksheet specified becomes the active worksheet in the active workbook.

The API.RunWorksheetSubmitData function returns the following:

Return Code Description

None

 

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Call LVAPI.RunWorksheetSubmitData(ActiveSheet)

 

'Submit active sheet by explicitly passing active sheet

Call LVAPI.RunWorksheetSubmitData (ActiveSheet)

 

'Submit active sheet by not specifying worksheet

Call LVAPI.RunWorksheetSubmitData ()

 

'Submit specifically named worksheet

Call LVAPI.RunWorksheetSubmitData (Worksheets(“Sheet1”))

 

'Submit a specific worksheet

Dim WSTest as Worksheet

Set WSTest = Worksheets(“NameOfAWorksheet”)

Call LVAPI.RunWorksheetSubmitData (WSTest)

API Properties

The following table lists the properties of the API class:

Name Type Description

ErrorCode

object

ErrorCode represents common error codes that may be returned by various functions.

IsConnected

boolean

IsConnected returns a Boolean value indicating whether the user is currently connected or not.

Version

string

Version is a string indicating the version of the Longview Add-In for Office.

Example:

Dim LVAPI As Longview.API

Set LVAPI = New Longview.API

Dim rc As Long: rc = LVAPI.ErrorCode.NoError

 

MsgBox "Longview Version " & LVAPI.Version, vbOKOnly + vbInformation, "Version Information"

   

If LVAPI.IsConnected Then  

      MsgBox "Connected", vbOKOnly + vbInformation, "Connection Successful"

Else 

MsgBox "Not connected" & vbLf & "Return code " & rc, vbOKOnly + vbExclamation, "Not Connected"   

End If

For an optimal Community experience, Please view on Desktop