Common Cube View Extender Business Rule Examples
Controlling Logo Display on Cube Views
Logos display in the Cube View Report Header only, but can vary by report, user security, be displayed on some reports and concealed on others, and placed on the left, center or right side of the page.
Conceal the Logo on Cube View Reports
Use Case: Users do not want to display a logo on a specific Cube View Report.
Function:
Case Is = CVExtenderFunctionType.FormatReportUIItem
Dim uiItem As CVExtenderReportUIItem = args.Report.CurrentUIItem
If uiItem.UIItemType = XFReportUIItemType.PageHeaderPictureBoxLogo Then
uiItem.Visible = False
End If
Vary by User Security
Use Case: Vary the logo that displays on a Cube View Report based on a user’s security group. The alternative logos must be in png format and saved in the OneStream File Explorer in order to reference them in the function.
Function:
Case Is = CVExtenderFunctionType.FormatReportUIItem
Dim uiItem As CVExtenderReportUIItem = args.Report.CurrentUIItem
If uiItem.UIItemType = XFReportUIItemType.PageHeaderPictureBoxLogo Then
If BRApi.Security.Authorization.IsUserInGroup(si, "SecurityGroup") Then
uiItem.SetPictureBoxImage(FileSystemLocation.ApplicationDatabase,"Documents/Public/Calculate.png",
TriStateBool.TrueValue)
End If
Vary Logo by Cube View Report
Use Case: Vary the logo that displays on a specific Cube View Report, based on the Page Caption property. The alternative logos must be in png format and saved in the OneStream File Explorer in order to reference them in the function.
Function:
Case Is = CVExtenderFunctionType.FormatReportUIItem
Dim uiItem As CVExtenderReportUIItem = args.Report.CurrentUIItem
If uiItem.UIItemType = XFReportUIItemType.PageHeaderPictureBoxLogo Then
If args.CubeView.PageCaption.Contains("Corp") Then
uiItem.SetPictureBoxImage(FileSystemLocation.ApplicationDatabase,"Documents/Public/Corporate.png",
TriStateBool.TrueValue)
Else
uiItem.SetPictureBoxImage(FileSystemLocation.ApplicationDatabase,"Documents/Public/Standard.png", TriStateBool.TrueValue)
End If
Vary Logo by Entity
Use Case: Vary the logo that displays on a specific Cube View Report, based on the Entity mentioned in the Cube View POV. The alternative logos must be in png format and saved in the OneStream File Explorer in order to reference them in the function.
Function:
Case Is = CVExtenderFunctionType.FormatReportUIItem Dim uiItem As CVExtenderReportUIItem = args.Report.CurrentUIItem
If uiItem.UIItemType = XFReportUIItemType.PageHeaderPictureBoxLogo Then
If args.CubeView.CubeViewPovMembers.Entity.Name.Contains("Corp") Then
uiItem.SetPictureBoxImage(FileSystemLocation.ApplicationDatabase,"Documents/Public/Corporate.png",
TriStateBool.TrueValue)
Else
uiItem.SetPictureBoxImage(FileSystemLocation.ApplicationDatabase,"Documents/Public/Standard.png", TriStateBool.TrueValue)
End If
Move Logo in Header
Case Is = CVExtenderFunctionType.FormatReportUIItem
Dim uiItem As CVExtenderReportUIItem = args.Report.CurrentUIItem
If uiItem.UIItemType = XFReportUIItemType.PageHeaderPictureBoxLogo Then
uiItem.Left = args.Report.CurrentPageInfo.RightPosition - uiItem.Width
End If
NOTE: CurrentPageInfo can also use CenterPosition in order to move the logo to the center of the report.
Customizing Cube View Report Headers/Footers
The following examples use header settings and can also be applied to footers.
Controlling the Width of Left, Right and Center Header Subtitles
Use Case: Control how a Report Header or Header Subtitles word wrap. When designing a Report Header using a combination of left, center, and right subtitles, each subtitle will automatically word wrap. For example, the header below has a long center subtitle and a right subtitle.
At runtime, this is how the Cube View Report displays:
In order to prevent the Center Subtitle from wrapping, apply a Cube View Extender function and control the width.
Function:
Case Is = CVExtenderFunctionType.FormatReportUIItem
Dim uiItem As CVExtenderReportUIItem = args.Report.CurrentUIItem
If uiItem.UIItemType = XFReportUIItemType.PageHeaderLabelCenter1 Then
uiItem.Width = 350
End If
Result:
Applying a Color Border to a Cube View Header
Use Case: The Cube View Header or Subtitle(s) need a border around it. Users can control the Border Sides, the Border Color, and the Border Thickness.
Function:
The function below is controlling the Center Subtitle’s width and putting a border around it.
Case Is = CVExtenderFunctionType.FormatReportUIItem
Dim uiItem As CVExtenderReportUIItem = args.Report.CurrentUIItem
If uiItem.UIItemType = XFReportUIItemType.PageHeaderLabelCenter1 Then
uiItem.Width = 350
uiItem.BorderSides = XFSides.All
uiItem.BorderColor = XFColors.XFDarkBlueBackground
uiItem.BorderThickness = 5
End If
Result:
Applying a Background Color/Font Color to a Header
Use Case: The Cube View Header or Subtitle(s) need a specific background color or font color. In the example below, the user would like the Center Subtitle highlighted in blue and the text in white font.
Function:
Case Is = CVExtenderFunctionType.FormatReportUIItem
Dim uiItem As CVExtenderReportUIItem = args.Report.CurrentUIItem
If uiItem.UIItemType = XFReportUIItemType.PageHeaderLabelCenter1 Then
uiItem.BackgroundColor = XFColors.SteelBlue
uiItem.TextColor = XFColors.White
End If
Result:
Cube View Text Wrapping
You can apply a consistent line width across a Cube View Row when text wrapping occurs in one or more Row expansions.
It is enabled on the Cube View Default as Header formatting.
There is a setting in the Reporting section of Header Formatting called ReportUseTableLayout. The ReportUseTableLayout default setting is False, which is the standard Cube View Label structure.
If set to True, the Labels are changed to a Table structure which allows the row height to be formatted across rows as text wrapping occurs within Row expansions.
Conditional Formatting
Use Case: Format cells based on the cell content. In the example below, the function will highlight any value less than $500,000 and place the text NODATA in any cell without a value.
Function:
Case Is = CVExtenderFunctionType.FormatReportUIItem
Dim uiItem As CVExtenderReportUIItem = args.Report.CurrentUIItem
If uiItem.UIItemType = XFReportUIItemType.DataCellLabel Then
Dim cvRow As CubeViewRow = uiItem.GetCubeViewRow()
If Not cvRow Is Nothing Then
End If
If uiItem.XFHasData Then
If uiItem.XFAmount < 500000.0 Then
uiItem.BackgroundColor = XFColors.SteelBlue
End If
Else
uiItem.Text = "NODATA"
uiItem.TextColor = XFColors.DarkBlue
uiItem.FontSize = 9
End If
End If
Result:
Page Number Display in Footer
Use Case: Format the page number in the Footer to display Page x of xx or Page x. Below is the standard page number format. Note that the setting to add a page number to Cube Views running in Data Explorer Report mode is determined under OnePlace/Application/Application Properties.
SetPageNumberDisplayInfo Function: Page x of xx
Case Is = CVExtenderFunctionType.FormatReportUIItem
Dim uiItem As CVExtenderReportUIItem = args.Report.CurrentUIItem
If uiItem.UIItemType = XFReportUIItemType.PageFooterPageNumber Then
uiItem.SetPageNumberDisplayInfo(True, "")
uiItem.SetPageNumberDisplayInfo(True, "Page {0} of {1}")
End If
Result:
SetPageNumberDisplayInfo Funtion: Page x
Case Is = CVExtenderFunctionType.FormatReportUIItem
Dim uiItem As CVExtenderReportUIItem = args.Report.CurrentUIItem
If uiItem.UIItemType = XFReportUIItemType.PageFooterPageNumber Then
uiItem.SetPageNumberDisplayInfo(False, "")
uiItem.SetPageNumberDisplayInfo(False, "Page {0}")
End If
Result: