For natural alphabetic sorting and grouping, create this Extensibility Rule and run it. Viola! Params Sorted like you would expect:
Imports System.Data
Imports OneStream.Shared.Common
Imports OneStream.Shared.Database
Imports OneStream.Shared.Wcf
Namespace OneStream.BusinessRule.Extender.ParameterSorter
'----------------------------------------------------------------------------------------------------------
'Reference Code: Parameter Sorter [ParamSorter]
'
'Description: This class sorts Dashboard Parameters for a given Workspace and Maintenance Unit
' Sort is standard lexical (Lexigraphical, Dictionary) order
' After running the rule refresh the application and workspace.
'
'Note: This will change sortorder setting on all parameters for the given Maintenance Unit
' (most people want this)
'
'Usage: Update Workspace and Maintenance Unit strings then run from the BR Editor.
'
'Created By: Robb Salzmann
'
'Date Created: 5-7-2023
'----------------------------------------------------------------------------------------------------------
Public Class MainClass
Public Function Main(si As SessionInfo, globals As BRGlobals, api As Object, args As ExtenderArgs) As Object
Try
Dim paramSort As New ParamSort()
paramSort.SortParams(si, args)
Catch ex As Exception
Throw New XFException($" {ex.Message}", ex)
End Try
Return Nothing
End Function
End Class
' Replace the string assignments for strWorkspace and strMaintUnit as appropriate
Class ParamSort
Public Sub SortParams(si As SessionInfo, args As ExtenderArgs)
'Workspace containing the Maintenance Unit below
Dim strWorkspace As String = "Default"
'Maintenance Unit where the Parameters will be sorted
Dim strMaintUnit As String = "My Maintenance Unit Name"
Dim results As DataTable = Nothing
Dim strSql As String = Nothing
Dim intSortOrder As Int32 = 10
Try
Dim wsGuid As Guid = BRApi.Dashboards.Workspaces.GetWorkspaceIDFromName(si, False, strWorkspace)
Dim muGuid As Guid = BRApi.Dashboards.MaintUnits.GetMaintUnit(si, False, wsGuid, strMaintUnit).UniqueID
strSql = $"SELECT dp.name as name
FROM DashboardMaintUnit dmu, DashboardParameter dp
WHERE dmu.UniqueID = '{muGuid}'
And dp.MaintUnitID = dmu.UniqueID
ORDER BY dp.name"
Using DbConn As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
results = BRApi.Database.ExecuteSql(dbConn, strSQL, True)
For Each row As DataRow In results.Rows
strSql = $"Update DashboardParameter set SortOrder={intSortOrder} where name='{row("name")}'"
BRApi.Database.ExecuteSql(dbConn, strSql, True)
intSortOrder += 10
Next
End Using
Catch ex As Exception
Throw New XFException($"{Environment.NewLine}{Me.GetType().ToString()}.{System.Reflection.MethodBase.GetCurrentMethod().Name}(): {ex.Message}:{Environment.NewLine}{strSql}", ex)
End Try
End Sub
End Class
End Namespace