Skip to main content
August 15, 2024
Solved

Reset parameter selections via business rule

  • August 15, 2024
  • 1 reply
  • 0 views

Does anyone know if its possible to reset parameter selections, like the button does below, via a business rule?


Sweez_0-1723729836794.png

 

Best answer by TheJonG

Hi - yes this is possible to do via a Dashboard Extender Rule that would be linked to a button or to execute on some other action. Below is some script that will reset a parameter to a blank value but you can substitute in any value you choose. Depending on where this runs from, you may need to change the DashboardExtenderFunctionType. For example, if wanting a parameter to reset after a button click then use args.LoadDashboardTaskInfo.Reason = LoadDashboardReasonType.ComponentSelectionChanged or if wanting parameter to reset whenever a dashboard is opened use DashboardExtenderFunctionType.LoadDashboard. Either way, the below script is what you need to reset or set a parameter value via a rule.


If args.FunctionName.XFEqualsIgnoreCase("ResetParams") Then
							
If args.LoadDashboardTaskInfo.Reason = LoadDashboardReasonType.ComponentSelectionChanged Then
Dim loadDashboardTaskResult As New XFLoadDashboardTaskResult()
											
								loadDashboardTaskResult.ChangeCustomSubstVarsInDashboard = True
								loadDashboardTaskResult.ModifiedCustomSubstVars.Add("ParameterName","")
														
	Return loadDashboardTaskResult
End If
End If

 

1 reply

TheJonGAnswer
August 15, 2024

Hi - yes this is possible to do via a Dashboard Extender Rule that would be linked to a button or to execute on some other action. Below is some script that will reset a parameter to a blank value but you can substitute in any value you choose. Depending on where this runs from, you may need to change the DashboardExtenderFunctionType. For example, if wanting a parameter to reset after a button click then use args.LoadDashboardTaskInfo.Reason = LoadDashboardReasonType.ComponentSelectionChanged or if wanting parameter to reset whenever a dashboard is opened use DashboardExtenderFunctionType.LoadDashboard. Either way, the below script is what you need to reset or set a parameter value via a rule.


If args.FunctionName.XFEqualsIgnoreCase("ResetParams") Then
							
If args.LoadDashboardTaskInfo.Reason = LoadDashboardReasonType.ComponentSelectionChanged Then
Dim loadDashboardTaskResult As New XFLoadDashboardTaskResult()
											
								loadDashboardTaskResult.ChangeCustomSubstVarsInDashboard = True
								loadDashboardTaskResult.ModifiedCustomSubstVars.Add("ParameterName","")
														
	Return loadDashboardTaskResult
End If
End If