Issue With Referencing Global Variables in Connector Business Rules
Hi all,
I am facing an issue regarding my ability to reference global objects between two different business rules, one of which is a finance business rule and the other of which is a connector business rule. To be more specific, the flow goes like this:
- First, I execute the finance business rule function that generates my global object, which is a DataTable, from a connector business rule:
-
BRApi.Finance.Calculate.ExecuteCustomCalculateBusinessRule(si, "Utilities", "GetDataTable", povInfo, CustomCalculateTimeType.MemberFilter)
-
- Then, in the GetDataTable function of the Utilities finance business rule, I create a DataTable and save it as a global object:
-
Dim dtCEDR_Integ As New DataTable("CEDR") 'add data to data table globals.SetObject("dtCEDR_Integ", dtCEDR_Integ)
-
- Then, back in the connector business rule, I try to get that global DataTable object.
-
Dim dtCEDR_Integ As DataTable = globals.GetObject("dtCEDR_Integ")
-
However, when I attempt to import the data via the data source that is attached to the connector business rule, I get this error: "Unable to execute Business Rule 'BudFm_BudEx_Connector'. Object reference not set to an instance of an object."
Interestingly enough, the error doesn't happen when I get the global object (i.e. step #3 above) - it happens when I try to reference properties of the datatable, ex.
dtCEDR_Integ.Rows.Count.ToString
This error confuses me greatly because I can do the exact same thing, except instead of using a connector business rule, I use an extender business rule, and everything works just fine. Is there something special about connector business rules that doesn't allow them to look at global variables the same way as other business rule types? Or am I just doing something wrong?
One additional piece of information that may be helpful to know is that the datatable that I am trying to generate does pull data from a cube that is separate from the cube that I'm importing into as specified in the data source. I don't think this would be causing issues but I want to add that in case that would in fact be an issue.
Thanks in advance and I am looking forward to learning more about this confusing scenario.
I haven't used the ExecuteMethodCommand, but it generally looks like it should work. It probably wants the Application Connection Info; BRApi.Database.CreateApplicationDbConnInfo(si).
Access the dataset: Dim dt as DataTable = dtDataSet.Tables(0) (its index based)
Import it: api.Parser.ProcessDataTable(...)