The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.
Forum Discussion
Mustafa_A
4 years agoContributor II
How to call Data Adapter in a Business Rule?
I'm working with a BI Viewer and working out how to sort the dates within the Time data set. Is their an API that allows to call the data adapter used within a dashboard?
Currently the dates on the...
- 4 years ago
Hi MarkHoughton
Apologies that I wasn't able to update this post earlier. But I was able to find a fix to this date issue -
You would need to switch this to TRUE
Now go back to your BI-Viewer. This should add "Start" and "End" Date data-items. Drag it to your argument pane and that should fix the dates on the axis. Hope this helps you save development time.
ChrisLoran
OneStream Employee
4 years agoYes you can call a Data Adapter using this method:
brapi.Dashboards.Process.GetAdoDataSetForAdapter
This is a snippet from which you should be able to adapt for your purposes, so you can get time-sorted pivot tables/pivot grids.
Dim dctVars As New Dictionary(Of String, String)
dctVars.Add("Cube", "MyCubeName")
dctVars.Add("Entity", "E1001")
dctVars.Add("SomeOtherParamX", "XXXX")
dctVars.Add("SomeOtherParamY", "YYYY")
Using ds As DataSet = brapi.Dashboards.Process.GetAdoDataSetForAdapter(si, False, "AdapterName", "ResultsTable", dctVars)
If ds.Tables.Count > 0 Then ' -- If there are >0 tables in the results
Using dt As DataTable = ds.Tables(0).Copy()
For Each dr As DataRow In dt.Rows
Dim strTime As String = dr("Time").ToString()
If strTime.Length = 6 Then
' convert e.g. 2022M1 to 2022M01
strTime = strTime.Substring(0, 5) & "0" & strTime.Substring(5, 1)
dr("Time") = strTime
End If
Next
Return dt ' --- return this modified table to the BI Analytics component
End Using
End If
End Using
Mustafa_A
4 years agoContributor II
Hi ChrisLoran
Very helpful post.
What is the purpose of dctVars?
Dim dctVars As New Dictionary(Of String,String)
dctVars.Add("Cube","MyCubeName")
dctVars.Add("Entity","E1001")
dctVars.Add("SomeOtherParamX","XXXX")
dctVars.Add("SomeOtherParamY","YYYY")
and how do you reference this rule within Dashboard BI component?
- rhankey4 years agoContributor III
To pass-in any optional parameters to the data adapter.
Related Content
- 2 years ago
- 3 years ago
- 4 years ago