Assign a value to a dashboard parameter from BR code

fc
New Contributor III

Hi all,

I'm currently developing a dashboard for a client and I need to assign a literal value to a dashboard parameter from the BR code. I'll try to explain the issue better:


I created the following parameter "test" within a dashboard group:

fc_0-1686299852832.png

 

within the BR, I entered the following:

fc_3-1686300270235.png

 

In this case, I'm trying to assign the text "SampleText" to the parameter "test".

I then created a combo box, I assigned the parameter "test" as a bound parameter, and placed the combo box in the dashboard:

fc_2-1686300153950.png

 

My goal is that, once triggered the BR, I will be able to see "SampleText" in the dashboard. 
Once the BR is triggered, though, no value is assigned to the parameter, and the combo box remains empty. 
What am I doing wrong?


 

7 REPLIES 7

MikeG
Contributor III

You're so close.  The Boolean indicator of False does not require quotes, that makes it a String and not a Type Boolean.

MikeG_0-1686315980939.png

 

MikeG
Contributor III

One more thing that will help, is to retrieve the literal parameter: Use an XFBR String rule to retrieve it.  Here is sample code to call the XFBR String rule, and function, and return the Literal Parameter to your Dashboard component.   The API call is GetLiteralParameterValue()

MikeG_0-1686318392508.png

 

You are talking about literal parameters. However, you are showing a combo box. Combo boxes work differently. They need either a bound list or a delimited list to work. In that case, you cannot use the code to set literalparametervalue, depending on how you want this to work. I'm assuming that you want that to be done when the dashboard launches; if that is the case, then you need to use the Dashboard extender rule and use the XFLoadDashboardTaskResult and set the modifiedcustomsubstvars dictionary (use the name of the parameter).

Dim loadDashboardTaskResult As New XFLoadDashboardTaskResult()
loadDashboardTaskResult.ModifiedCustomSubstVars("YourParamName") = "Valueyouwanttoset"

Once you have that done, add that rule to your load dashboard server task arguments.

ghoang
New Contributor II

Will this pre-set the combo box that is in another dashboard with a default value?

Here's what I want to do: I have a button in HomePage DB, and I want to be able to click on that button from HomePage and have Guided Reporting pulled up with Report Group combo box value set to a default value.

I have tried this but was unsuccessful: Attached a rule with XFSelectionChangedTaskResult to the button in HomePage & set navigation action to open up Guided Reporting. Navigation action works fine but I cannot get the Report Group combo box to set to a default.

I cannot put another XFLoadDashboardTaskResult  on Guided Reporting DB because there's already one that's from MP solutions.

ChristianW
Valued Contributor

You can create your own OnLoadDashbord business rule, then run the Guided Reporting one, save the resulting XFLoadDashboardTaskResult object in a variable and then add/change the custom variables to whatever you like.

This is advanced customization, you should know what you do and test it carefully.

Dim gdrMainClass As New OneStream.BusinessRule.DashboardExtender.GDR_SolutionHelper.MainClass
Dim onLoadResult As XFLoadDashboardTaskResult = gdrMainClass.Main(si, globals, api, args)
onLoadResult.ModifiedCustomSubstVars.Add("Test", "True")
Return onLoadResult

And you should create a new dashboard to replace 0_Frame_GDR_Main_OnePlace to not spoil the installation.

 

ChristianW
Valued Contributor

Please do not use literal parameters for this purpose, except if you like to use it to store something for everybody using your dashboard.

You should always use the XFLoadDashboardTaskResult or XFSelectionChangedTaskResult objects to pass values to parameters using a business rule.

Cheers

Christian

fc
New Contributor III

Thank you all for the help!!