Forum Discussion

drgerrow's avatar
drgerrow
New Contributor III
2 years ago

Can a Combobox set its value dynamically on a dashboard load/refresh?

Hello - we'd like the ability for a Combobox to run an XFBR to generate the default visible value every time the dashboard is opened/refreshed.  We want to provide the user with a 'suggested' value that can differ depending on Workflow, Scenario, Time, etc., and then let them select an alternate choice if applicable.

Does anyone know if this functionality on Comboboxes/Dashboards is possible within OneStream Dashboarding today?

  • Hey Darryl,

    Yea you can do it, it would be done via a dashboard extender rule, and you can set the parameter to whatever value you want. Let me know if you want a sample of the code to do it and I will find and example. 

    Thanks

  • drgerrow's avatar
    drgerrow
    New Contributor III

    Hi Sam - yes, would appreciate seeing a quick sample if you have one available!

    • SamRichards's avatar
      SamRichards
      Contributor

      Here you go. This example is using literal parameters to set the combo boxes but you could pass through parameters on the extender call to do it instead of the literal parameters. Also at the top of this call it will only run this rule on the intial load of the dashboard which I believe is what you would want to do.

       

      Case Is = DashboardExtenderFunctionType.LoadDashboard
                              If (args.FunctionName.XFEqualsIgnoreCase("OnLoadWaterFallDashboard")) Then 
                                  If args.LoadDashboardTaskInfo.Reason = LoadDashboardReasonType.Initialize And args.LoadDashboardTaskInfo.Action = LoadDashboardActionType.BeforeFirstGetParameters Then' Or LoadDashboardReasonType.ComponentSelectionChanged Then '                                 'Initialize Message 
                                      Dim loadDashboardTaskResult As New XFLoadDashboardTaskResult() 
                                      loadDashboardTaskResult.ChangeCustomSubstVarsInDashboard = True 
                                      Dim Comp2Scn As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "Param_Water_LiteralSelectComp2Scn")
                                      Dim Comp2Time As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "Param_Water_LiteralSelectComp2Time")
                                      Dim Comp1Scn As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "Param_Water_LiteralSelectComp1Scn")
                                      Dim Comp1Time As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "Param_Water_LiteralSelectComp1Time")
                                      Dim CurScn As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "Param_Water_LiteralSelectCurScn")
                                      Dim CurTime As String = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "Param_Water_LiteralSelectCurTime")
                                  'Brapi.ErrorLog.LogMessage(si, Comp2Scn & Comp2Time &Comp1Scn &Comp1Time &CurScn &CurTime )
                                      loadDashboardTaskResult.ModifiedCustomSubstVars.Add("Param_GPS_SelCompFCast", Comp1Scn) 
                                      loadDashboardTaskResult.ModifiedCustomSubstVars.Add("Param_GPS_SelCompFcstTimeMth", Comp1Time) 
                                      loadDashboardTaskResult.ModifiedCustomSubstVars.Add("Param_GPS_SelComp2FCast", Comp2Scn) 
                                      loadDashboardTaskResult.ModifiedCustomSubstVars.Add("Param_GPS_SelComp2FcstTimeMth", Comp2Time) 
                                      loadDashboardTaskResult.ModifiedCustomSubstVars.Add("Param_SelectCurFcst", CurScn) 
                                      loadDashboardTaskResult.ModifiedCustomSubstVars.Add("Param_SelectCurFcstTimeMth", CurTime)                                 
                                          Return loadDashboardTaskResult 
                                  End If 
                              End If

       

      THanks,

  • Is setting a default on a parameter not working? If not, then you'll have to go with the extender route of setting the parameter while launching it.