Button Highlighting Business Rule - "Load Dashboard Server Task (Once)" running twice?
Hello,
I have a problem with a couple business rules running at the wrong times from within a dashboard.
The background: I have a business rule that changes the formatting of the buttons on a dashboard to show which one was clicked last. The buttons function as "tabs," each linking to a report; the button linking to the currently selected report shows itself as highlighted.
To do this, I have the name of the current active button stored in a literal parameter.
When a button is clicked to launch a report, a business rule rewrites the value of this literal parameter. (An XFBR String rule then reads this parameter to determine how to format the buttons, and is output to button - formatting - display format).
The problem: When I launch the dashboard from OnePlace, the highlighting works correctly, showing a set of buttons with the first button highlighted.
When I click another button, the button works correctly by launching a report, but the first button remains highlighted. The literal parameter does not update with the name of the newly clicked button as it should. BUT if I click any other button a second time, the highlighting starts working correctly, and the literal parameter is rewritten by the BR.
So what's happening? When I launch the DB from OnePlace, a Load Dashboard Server Task runs (DashboardExtenderFunctionType.LoadDashboard).
When I click a button within the dashboard, a Selection Changed Server Task runs (DashboardExtenderFunctionType.ComponentSelectionChanged).
It looks like the first time a button is pushed, either the Load DB server task is running a second time or the Selection Changed server task is not running. I don't know why a second push of the button changes its behavior.
I don't know how to track the problem any further and would love your thoughts if you've read this far; any ideas?
Rewrite literal parameter BR:
Namespace OneStream.BusinessRule.DashboardExtender.Button_Format
Public Class MainClass
Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardExtenderArgs) As Object
Try
Dim bda = New OneStream.BusinessRule.Finance.BDA_BRFramework.MainClass(si, globals)
Select Case args.FunctionType
Case Is = DashboardExtenderFunctionType.LoadDashboard
If args.FunctionName.XFEqualsIgnoreCase("ActiveButton_Launch") Then
'Implement Load Dashboard logic here.
Dim strButtonName As String = args.NameValuePairs("ButtonName")
BRApi.Dashboards.Parameters.SetLiteralParameterValue(si, False, "param_active_Btn", strButtonName)
Dim loadDashResult As New XFLoadDashboardTaskResult()
Return loadDashResult
End If
Case Is = DashboardExtenderFunctionType.ComponentSelectionChanged
If args.FunctionName.XFEqualsIgnoreCase("ActiveButton") Then
'Implement Dashboard Component Selection Changed logic here.
Dim strButtonName As String = args.NameValuePairs("ButtonName")
BRApi.Dashboards.Parameters.SetLiteralParameterValue(si, False, "param_active_Btn", strButtonName)
Dim selectionChangedTaskResult As New XFSelectionChangedTaskResult()
Return selectionChangedTaskResult
End If
End Select
Calvin,
Just a side comment: I wouldn't use a literal parameter to store the value of what button was pressed. The literal parameter is shared with all your users and you will run into a problem where one user session overwrites the parameter value while another user session will eventually read the updated value but it doesn't reflect what the user should be seeing.
A workaround would be to setup a runtime parameter that you then save to the dashboard parameter dictionary (i.e. args.LoadDashboardTaskInfo.CustomSubstVarsFromPriorRun in LoadDashboard section and args.SelectionChangedTaskInfo.CustomSubstVars in ComponentSelectionChanged section).
Also that db_pdx said: have you tried "Tabs"