Hello,
I am adding a formula field to ugReport grid. It seem by default the Formula Builder loads all availble columns Infragistic controls (grids, dropdowns, so on...) . Is there a way to specify which control should be availble in for the user to create formula? Ideally, I want the user only to have access to all the columns of ugReport grid.
Hi,
I took a look at the FormulaBuilder Runtime sample and it's doing exactly what you describe by hooking into the OperandInitializing event of the FormulaBuilderDialog and setting e.Cancel to true for the item that should not be shown.
Hi, is there a code example for this? I am getting the same thing, I only want it to show me one particular grid but it shows me all the grids and drop downs on the form, I too am using the code in the sample, though slightly altered ShowFormulaBuilderDialog to return true/false for my purposes shown below.
Note it also does not seem to exclude the text fields either:
Private Sub formulaBuilder_OperandInitializing(ByVal sender As Object, ByVal e As OperandInitializingEventArgs)
Dim mvarSummarySettings As SummarySettings
' See if the FormulaProvider is a SummarySettings
If (TypeOf e.FormulaProvider Is SummarySettings) Then
mvarSummarySettings = DirectCast(e.FormulaProvider, SummarySettings)
' Get the source column for the Summary
Dim summaryColumn As UltraGridColumn = mvarSummarySettings.SummaryPositionColumn
' It doesn't make sense for the Summary formula to use values from any
' other grid columns except the source column, so filter those out.
If (TypeOf e.OperandContext Is UltraGridColumn _
AndAlso Not e.OperandContext Is summaryColumn) Then
e.Cancel = True
End If
End Sub
' This event fires for each function added to the list
' of functions in the FormulaBuilder and provides the
' opportunity to cancel them.
Private Sub formulaBuilder_FunctionInitializing(ByVal sender As Object, ByVal e As FunctionInitializingEventArgs)
' Some of the available functions do not make sense for Integer
' data. So filter out functions.
Select Case (e.Function.Category)
Case "Information", "Logical", "TextAndData"
End Select
Public Function ShowFormulaBuilderDialog(ByVal formulaProvider As IFormulaProvider) As Boolean
' Declare a new FormulaBuilderDialog
Dim mvarFormulaBuilderDialog As FormulaBuilderDialog = New FormulaBuilderDialog(formulaProvider)
AddHandler mvarFormulaBuilderDialog.OperandInitializing, AddressOf formulaBuilder_OperandInitializing
AddHandler mvarFormulaBuilderDialog.FunctionInitializing, AddressOf formulaBuilder_FunctionInitializing
Try
' Show the dialog
Dim dResult As DialogResult = mvarFormulaBuilderDialog.ShowDialog(Me)
' If the user cancelled, do nothing
If (dResult = DialogResult.Cancel) Then Return False
' Apply the formula
formulaProvider.Formula = mvarFormulaBuilderDialog.Formula
Return True
Finally
' Whatever happens, make sure we disconnect from
' the events
RemoveHandler mvarFormulaBuilderDialog.OperandInitializing, AddressOf formulaBuilder_OperandInitializing
RemoveHandler mvarFormulaBuilderDialog.FunctionInitializing, AddressOf formulaBuilder_FunctionInitializing
End Try