Skip to main content
December 14, 2023
Solved

Error in BR: Object reference not set to an instance of an object.

  • December 14, 2023
  • 2 replies
  • 0 views

Hi, I have the following code that gives me an error: Object reference not set to an instance of an object.

Dim listMbrEntityD As New List(Of Member)

Dim dimpkEntityD As New DimPk(mbrEntityD.DimTypeId, mbrEntityD.DimId)
listMbrEntityD.AddRange(BRApi.Finance.Members.GetBaseMembers(si, dimpkEntityD, mbrEntityD.MemberId))

I have debugged with errorlog but it doesn’t manage to print anything to see the values, any idea how to solve it?

Best answer by DanielWillis

The reason you got no values in your debug is probably the same reason you're getting the error. Something you're trying to use is not set to anything.

E.g., mbrEntityD, dimpkEntityD, or the result of "BRApi.Finance.Members.GetBaseMembers(si, dimpkEntityD, mbrEntityD.MemberId)"

Check those one by one and I think you'll find it.

2 replies

Employee
December 14, 2023

The reason you got no values in your debug is probably the same reason you're getting the error. Something you're trying to use is not set to anything.

E.g., mbrEntityD, dimpkEntityD, or the result of "BRApi.Finance.Members.GetBaseMembers(si, dimpkEntityD, mbrEntityD.MemberId)"

Check those one by one and I think you'll find it.

MarcoAuthor
December 15, 2023

Hi Daniel, I saw that my empty variable is mbrEntityD, which is extracted in the following way.

Dim mbrEntityD As Member = BRApi.Finance.Members.GetMember(si, dimTypeId.Entity, drAllocRegister("DEntity").ToString)

And the values: Entity - 11201_12207.
Do you know how I can verify the information that getmember returns to me with those values?

Employee
December 18, 2023

Sorry I'm not quite sure what you mean. My Guess is that 'drAllocRegister("DEntity").ToString' is not returning what you expect though.

December 19, 2023

Hi Marco,

Try adding the line below and then run it and check it in the System/Error Log. Then you can check that you're selecting the right member looking to the memberID information.

Good luck

Carlos

 

 

 

BRApi.ErrorLog.LogMessage(si, mbrEntityD.ToString)