Forum Discussion
Hi Bella_Yu
First you need to pass the parameter selected value into your logic. Then you need to pass that value into the dctVars dictionary that you had created (which was empty in your example). The BRApi expects you to pass in a dictionary with parameters to resolve here. I have provided sample code below for using a dashboard dataset rule to pick up value from your original data adapter
' {YourBusinessRuleName}{YourFunctionName}{Entity=[|!Select_Entity_EP!|]}
If args.DataSetName.XFEqualsIgnoreCase("YourFunctionName") Then
' Retrieve Entity passed in from Parameter Value using args.NameValuePairs
Dim entityName As String = args.NameValuePairs.XFGetValue("Entity")
Dim isSystemLevel As Boolean = False
Dim workspaceID As Guid = BRApi.Dashboards.Workspaces.GetWorkspaceIDFromName(si, isSystemLevel, "Default")
Dim adapterName As String = "da01_entity_hierarchy_filtered"
Dim rsTableName As String = "OutputTable"
Dim dctVars As New Dictionary(Of String, String)
' Add Parameter values you want to resolve to the dictionary created (that we pass into the BRApi)
' In this case the Key will be the name of the Parameter you want to resolve and the Value will be the value from your parameter selection
dctVars.Add("Select_Entity_EP", entityName)
Using ds As DataSet = brapi.Dashboards.Process.GetAdoDataSetForAdapter(si, isSystemLevel, workspaceID, adapterName, rsTableName, dctVars)
If ds.Tables.Count > 0 Then 'If there are >0 tables in the results
Using dt As DataTable = ds.Tables(0).Copy()
op_table = dt.Copy() ' Clone the DataTable
End Using
End If
End Using
End If
You could then call the function using something like this (depending on your calling method) e.g.
{YourBusinessRuleName}{YourFunctionName}{Entity=[|!Select_Entity_EP!|]}
But regardless of which type of rule you pick to execute your logic. The principles will be the same e.g pass your parameter(s) into your logic and then resolve them using the dictionary, in your case dctVars
Related Content
- 11 months ago
- 6 months ago
- 8 months ago
- 3 years ago