Unlock/Locking using VB Script
724777Oct 1 2009 — edited Nov 8 2009I am trying lock/unlock entities using VB script using the SetCalcStatusLocked API for HFM. The code is below. The routine appears to run but the entity status does not change to locked. Am I missing a step somewhere?
Thanks you
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' SubProgram: Lock
' Parameters: lScenario
' lYear
' lPeriod
' lEntity
' lParent
' lValue
' Purpose: Lock the process unit for the given Parameters
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Lock(lScenario, lYear, lPeriod, lEntity, lParent, lValue)
On Error Resume Next
Dim oLock
If g_oSession Is Nothing Then
Log "Application needs to be opened before performing this operation!"
Err.Clear
Exit Sub
End If
Set oLock = WScript.CreateObject("Hyperion.HFMwData")
If Err Then
Log "Unable to create HFMwData. Please ensure this component is installed and registered!"
Log Err.Description
Err.Clear
Exit Sub
End If
oLock.SetWebSession(g_oSession)
oLock.SetCalcStatusLocked lScenario, lYear, lPeriod, lEntity, lParent, lValue
If Err Then
Log Err.Description & "xx" & g_oSession & "_" & lScenario & "_" & lYear & "_" & lPeriod & "_" & lEntity & "_" & lParent & "_" & lValue
Err.Clear
Exit Sub
End If
Exit Sub
End Sub