Article Details
Id:13016
Product:finPOWER Connect
Type:FIX
Version:2.03.00
Opened:19/06/2015
Closed:19/06/2015
Released:09/07/2015
Job: J015744

Business Layer; finAccountCalculationVersion.Summary may fail

The finPOWER Connect Business Layer method finAccount.CalculationVersions(index).Summary may fail with the error "Object reference not set to an instance of an object.".

An example of code to reproduce the issue is below.

  Dim Account As finAccount
  Dim AccountSummary As finAccountSummary

  ' Assume Success
  Main = True

  Account = finBL.CreateAccount

  If Account.Load("L10035") Then
    AccountSummary = Account.CalculationVersions(0).Summary
  Else
    Main = False
  End If

A workaround is to load the Account Calculation first, example code below:

  Dim Account As finAccount
  Dim AccountCalc As finAccountCalc
  Dim AccountSummary As finAccountSummary
  
  ' Assume Success
  Main = True
  
  Account = finBL.CreateAccount
  
  If Account.Load("L10035") Then
    If Account.CalculationVersions(0).GetAccountCalc(AccountCalc) Then 
      AccountSummary = Account.CalculationVersions(0).Summary
    Else
      Main = False
    End If
  Else
    Main = False
  End If

Note, this issue has been fixed in version 2.3.0.