FDXExecuteCubeView

Akalya_N
New Contributor

Hi Community... I'm trying to extract data from CV using FdxExecuteCubeView method..So, if anyone give sample code for that with respected method query means... It'll be very helpful to refer...
    I want to know how we are passing values in this method...By CV POV...?
Thank You...!

2 ACCEPTED SOLUTIONS

Sergey
Contributor III

Hi @Akalya_N !

I am usually using this bit of code here below. This is a code in a "Dashboard data set" business rule that is called out by a Dashboard Extender or a Dashboard XFBR String business rule. In this exemple, you'll notice that cube view, entity & scenario information are variable passed from these other business rule.

I am also using a log message to test if the datatable resulting from the FDXexecutecubeview exist - just in case !

I still havent figured out how to pass parameters so I would suggest for you if you want to use it, to have a cube view without parameters as a source ...

#Region "CubeViewFDX"

Public Function CubeViewFDX(ByVal si As SessionInfo, ByVal str_CubeViewName As String, ByVal ScenarioDimName As String, ByVal EntityDimName As String, ByVal entityMemFilter As String, ByVal scenarioMemFilter As String) As datatable




Try




brapi.ErrorLog.LogMessage(si, "Cube View : " & str_CubeViewName)

brapi.ErrorLog.LogMessage(si, "Scenario Dimension Name : " & ScenarioDimName.ToString)

brapi.ErrorLog.LogMessage(si, "Entity Dimension Name : " & EntityDimName.ToString)

brapi.ErrorLog.LogMessage(si, "Entity Member filter : " & entityMemFilter.ToString)

brapi.ErrorLog.LogMessage(si, "Scenario Member filter : " & scenarioMemFilter.ToString)




'Dim nvbParams As New NameValueFormatBuilder(String.Empty, args.CustomSubstVars, False)

Dim fakedict As New Dictionary(Of String, String)

Dim nvbParams As New NameValueFormatBuilder(String.Empty, fakedict,False)

Dim cvNameToExtract As String = str_CubeViewName.ToString

'Dim entityDimName As String = str_EntityDimName.ToString

'Dim entityMemFilter As String = args.NameValuePairs.XFGetValue("entityMemFilter")

'Dim scenarioDimName As String = str_ScenarioDimName.ToString

'Dim scenarioMemFilter As String = String.Empty

Dim timeMemFilter As String = String.Empty

'Dim nameValuePairs As NameValueFormatBuilder = New NameValueFormatBuilder(String.Empty)

Dim includeCellText As Boolean = False

Dim useStandardFields As Boolean = True

Dim filter As String = String.Empty

Dim parallelQueryCount As Integer = 2

Dim logStats As Boolean = False

Dim dt As DataTable = BRApi.Import.Data.FdxExecuteCubeView(si, cvNameToExtract,entityDimName,entityMemFilter, scenarioDimName, scenarioMemFilter, timeMemFilter, nvbParams, includeCellText, useStandardFields, filter, parallelQueryCount, logStats)










If Not dt Is Nothing Then

brapi.ErrorLog.LogMessage(si, "dt exist")

Return dt

Else

brapi.ErrorLog.LogMessage(si, "dt doesn't exist")

Return Nothing

End If




Catch ex As Exception

Throw New System.Exception ("An error has occurred")

End Try




End Function

#End Region

 Regards,

View solution in original post

Henning
Valued Contributor

Hello, there are a few posts existing already, here is a lengthy one where members of the community provided some sample code. 

https://community.onestreamsoftware.com/t5/Workflow-and-Data-Integration/FdxExecuteCubeView-paramete...

Hope that helps!

View solution in original post

2 REPLIES 2

Sergey
Contributor III

Hi @Akalya_N !

I am usually using this bit of code here below. This is a code in a "Dashboard data set" business rule that is called out by a Dashboard Extender or a Dashboard XFBR String business rule. In this exemple, you'll notice that cube view, entity & scenario information are variable passed from these other business rule.

I am also using a log message to test if the datatable resulting from the FDXexecutecubeview exist - just in case !

I still havent figured out how to pass parameters so I would suggest for you if you want to use it, to have a cube view without parameters as a source ...

#Region "CubeViewFDX"

Public Function CubeViewFDX(ByVal si As SessionInfo, ByVal str_CubeViewName As String, ByVal ScenarioDimName As String, ByVal EntityDimName As String, ByVal entityMemFilter As String, ByVal scenarioMemFilter As String) As datatable




Try




brapi.ErrorLog.LogMessage(si, "Cube View : " & str_CubeViewName)

brapi.ErrorLog.LogMessage(si, "Scenario Dimension Name : " & ScenarioDimName.ToString)

brapi.ErrorLog.LogMessage(si, "Entity Dimension Name : " & EntityDimName.ToString)

brapi.ErrorLog.LogMessage(si, "Entity Member filter : " & entityMemFilter.ToString)

brapi.ErrorLog.LogMessage(si, "Scenario Member filter : " & scenarioMemFilter.ToString)




'Dim nvbParams As New NameValueFormatBuilder(String.Empty, args.CustomSubstVars, False)

Dim fakedict As New Dictionary(Of String, String)

Dim nvbParams As New NameValueFormatBuilder(String.Empty, fakedict,False)

Dim cvNameToExtract As String = str_CubeViewName.ToString

'Dim entityDimName As String = str_EntityDimName.ToString

'Dim entityMemFilter As String = args.NameValuePairs.XFGetValue("entityMemFilter")

'Dim scenarioDimName As String = str_ScenarioDimName.ToString

'Dim scenarioMemFilter As String = String.Empty

Dim timeMemFilter As String = String.Empty

'Dim nameValuePairs As NameValueFormatBuilder = New NameValueFormatBuilder(String.Empty)

Dim includeCellText As Boolean = False

Dim useStandardFields As Boolean = True

Dim filter As String = String.Empty

Dim parallelQueryCount As Integer = 2

Dim logStats As Boolean = False

Dim dt As DataTable = BRApi.Import.Data.FdxExecuteCubeView(si, cvNameToExtract,entityDimName,entityMemFilter, scenarioDimName, scenarioMemFilter, timeMemFilter, nvbParams, includeCellText, useStandardFields, filter, parallelQueryCount, logStats)










If Not dt Is Nothing Then

brapi.ErrorLog.LogMessage(si, "dt exist")

Return dt

Else

brapi.ErrorLog.LogMessage(si, "dt doesn't exist")

Return Nothing

End If




Catch ex As Exception

Throw New System.Exception ("An error has occurred")

End Try




End Function

#End Region

 Regards,

Henning
Valued Contributor

Hello, there are a few posts existing already, here is a lengthy one where members of the community provided some sample code. 

https://community.onestreamsoftware.com/t5/Workflow-and-Data-Integration/FdxExecuteCubeView-paramete...

Hope that helps!