Article Details
Id:18828
Product:finPOWER Connect
Type:FIX
Version:3.04.03
Opened:19/11/2021
Closed:07/12/2021
Released:01/02/2022
Job: J027819

Retrieving a Security Statement Id from a Security Statement Pk may return an error

When using the Business Layer function SecurityStmtFunctions.GetSecurityStmtIdFromSecurityStmtItemPk to retrieve the Security Statement Id from the Security Statement Pk you may encounter an error "Failed to get Security Statement Id from Security Statement Item primary key X. Failed to get Scalar String value. The specified field '[Pk]' could refer to more than one table listed in the FROM clause of your SQL statement."

Option Explicit On
Option Strict On

' #################################################################
' Test returning a Security Statement Id from the 
' Security Statement Pk.
'
' Version: 1.00 (7/12/2021)
'
' Usage: Location that this Script is used
' #################################################################
' Version        Date  User     Job       Description
' -------  ----------  -------  --------  -------------------------
'    1.00  7/12/2021  ISS                Created
' #################################################################

Public Function Main(userInterface As ISUserInterfaceBL, reports As ISfinReports, parameters As ISKeyValueList) As Boolean

  ' Parameters:
  '   userInterface - The User Interface object
  '   reports - The Reports object
  '   parameters - Other values passed to the Script

  Dim SecurityStmtItemPk As Integer
  Dim SecurityStmtId As String

  ' Assume Success
  Main = True

  ' Initialise - Change the SecurityStmtItemPk to a valid value
  SecurityStmtItemPk = 0
  SecurityStmtId = ""

  If finBL.SecurityStmtFunctions.GetSecurityStmtIdFromSecurityStmtItemPk(SecurityStmtItemPk, SecurityStmtId)
    finBL.DebugPrintFormat(SecurityStmtId)
  Else
    Main = False
  End If

  Return Main
  
End Function