NickKroppe
3 years agoContributor
UD8 Dynamic Calc - Retrieve Data From Another Application
Hello,
I wanted to post this here since this came up at the Wave Conference in Vegas last week. Below is a snippet you can leverage to pull data from another application via a UD8 dynamic calc. This approach uses the CreateSessionInfoForAnotherApp BRApi to create a session in another application with the current user's credentials which ultimately enables you to execute any BRApi function (such as the GetDataCellUsingMemberScript BRApi) against another application in the same environment. This technique can be especially useful when looking to report on data that lives in two applications (in the same environment) in cube views and quick views.
'define the other application name you wish to connect to - this must be an app that lives within the same environment
'the user must also have access to the application to authenticate to it
Dim otherAppName As String = "SomeOtherApp"
'create the session info to the other app and store it globally in memory
Dim otherAppSeshInfo As SessionInfo = globals.GetObject("OtherAppSeshInfo")
If (otherAppSeshInfo Is Nothing) Then
otherAppSeshInfo = BRApi.Security.Authorization.CreateSessionInfoForAnotherApp(si, otherAppName, OpenAppResult.Success)
globals.SetObject("OtherAppSeshInfo", otherAppSeshInfo)
End If
'get the POV intersection from the CV and swap out the UD8 none member with the name of this UD8 reporting member
Dim povMemberScript As String = api.Data.CreateMemberScriptBuilder(True, True, True, True).GetMemberScript().Replace("U8#GetDataFromAnotherApp", "U8#None")
'return the POV cell amount from the other application
Return BRApi.Finance.Data.GetDataCellUsingMemberScript(otherAppSeshInfo, api.Pov.Cube.Name, povMemberScript).DataCellEx.DataCell.CellAmount
Regards,
Nick Kroppe
Advanced Application Solutions
OneStream Software