Last active
December 4, 2024 09:28
-
-
Save toyg/ade825028b07eeca05ee0e43d4d8a584 to your computer and use it in GitHub Desktop.
DataSet Service rule for Menu Component in OneStream 8.5+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System | |
Imports System.Collections.Generic | |
Imports System.Data | |
Imports System.Data.Common | |
Imports System.Globalization | |
Imports System.IO | |
Imports System.Linq | |
Imports Microsoft.VisualBasic | |
Imports OneStream.Finance.Database | |
Imports OneStream.Finance.Engine | |
Imports OneStream.Shared.Common | |
Imports OneStream.Shared.Database | |
Imports OneStream.Shared.Engine | |
Imports OneStream.Shared.Wcf | |
Imports OneStream.Stage.Database | |
Imports OneStream.Stage.Engine | |
Imports OneStreamWorkspacesApi | |
Imports OneStreamWorkspacesApi.V800 | |
Namespace Workspace.__WsNamespacePrefix.__WsAssemblyName | |
Public Class DatasetSvc | |
Implements IWsasDataSetV800 | |
Public Function GetDataSet(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal workspace As DashboardWorkspace, _ | |
ByVal args As DashboardDataSetArgs) As Object Implements IWsasDataSetV800.GetDataSet | |
Try | |
If (globals IsNot Nothing) AndAlso (workspace IsNot Nothing) AndAlso (args IsNot Nothing) Then | |
' sample menu implementation | |
If args.DataSetName.XFEqualsIgnoreCase("MainMenu") Then | |
' create the menu object | |
Dim menu As New XFMenuItemCollection() | |
' create top-level items | |
Dim parentMenuItemOne As New XFMenuItem("1", "Parent 1", _ | |
"White", "SlateGray", False, False, True, False, Nothing) | |
' create items for the second level | |
Dim childMenuItemOne As New XFMenuItem("1.1", "Child 1", _ | |
"Black", "White", True, True, True, False, Nothing) | |
Dim childMenuItemTwo As New XFMenuItem("1.2", "Child 2", _ | |
"Black", "White", True, True, True, False, Nothing) | |
' create items for the third level | |
Dim grandChildMenuItemOne As New XFMenuItem("1.1.1", "Grandchild 1", _ | |
"White", "SlateGray", True, True, True, False, Nothing) | |
' create the hierarchy by adding children to direct parents as a List | |
childMenuItemOne.Children = New List(Of XFMenuItem) _ | |
From {grandChildMenuItemOne} | |
parentMenuItemOne.Children = New List(Of XFMenuItem) _ | |
From {childMenuItemOne} | |
' you can also manipulate the list once created | |
parentMenuItemOne.Children.Add(childMenuItemTwo) | |
' add top-level items to the menu object | |
menu.MenuItems.Add(parentMenuItemOne) | |
' generate the dataset and return it | |
Return menu.CreateDataSet(si) | |
End If | |
End If | |
Return Nothing | |
Catch ex As Exception | |
Throw New XFException(si, ex) | |
End Try | |
End Function | |
End Class | |
End Namespace |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment