I am not sure as to why you are leveraging the table for such a check, as the lock on a WF is a combination of Workflow, Scenario and Time in combination.
Normally we use other functionality, here is an example of a simple check:
' Create stringbuilder
Dim sb As New Text.StringBuilder
'Logic to check if a WF is locked and perform action or not
Dim wfClusterPK As New WorkflowUnitClusterPk(si.WorkflowClusterPk.ProfileKey,si.WorkflowClusterPk.ScenarioKey,si.WorkflowClusterPk.TimeKey)
'Get the Workflow Overall Status
Dim wfStatus As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfClusterPk,True)
'Only log the error if wfStatus NOT locked
If Not wfStatus.Locked Then
sb.AppendLine("Test 1: WF Status is NOT Locked")
'Only log the error if wfStatus IS locked
Else If wfStatus.Locked
sb.AppendLine("Test 2: WF Status IS Locked")
End If
' Log Result -> Throw Error
Throw New XFException(Convert.ToString(sb))
Regards, Joakim