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

Marco
Contributor II

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?

1 ACCEPTED SOLUTION

DanielWillis
Contributor III

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.

View solution in original post

4 REPLIES 4

DanielWillis
Contributor III

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.

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?

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

CarlosAlvear
Contributor

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)