Class GridGroupByExpression
Expression similar to SQL's "Select Group By" clause that is used by GridTableView to group items . Expressions can be defined by assigning Expression property and/or managing the items in SelectFields or GroupByFields collections.
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.GridView.dll
Syntax
public class GridGroupByExpression : GroupDescriptor, INotifyPropertyChanged
Remarks
If you use Expression property to assign group by expression as string then the expression is parsed and SelectFields and GroupByFields are created. If the expression syntax is incorrect a System.FormatException would be thrown. You can use GridGroupByField's properties to set expression's fields appearance format strings, etc. See Expression property for details about the expression syntax.
Constructors
GridGroupByExpression()
Initializes a new instance of the GridGroupByExpression class.
Declaration
public GridGroupByExpression()
GridGroupByExpression(String)
Initializes a new instance of the GridGroupByExpression class.
Declaration
public GridGroupByExpression(string expression)
Parameters
System.String
expression
The expression. |
GridGroupByExpression(String, String)
Initializes a new instance of the GridGroupByExpression class.
Declaration
public GridGroupByExpression(string expression, string defaultFormatString)
Parameters
System.String
expression
The expression. |
System.String
defaultFormatString
The default format string. |
GridGroupByExpression(GridViewDataColumn)
Constructs a new GroupByExpression from a grid GridColumn.
Declaration
public GridGroupByExpression(GridViewDataColumn column)
Parameters
GridViewDataColumn
column
the column (and its FieldName respectively) that will be used for grouping RadGridView |
Remarks
The AllowGroup of the column should be true. The following properties will be copied from the corresponding column's properties:
Fields
GroupByClause
Declaration
public const string GroupByClause = "Group By"
Field Value
System.String
|
Properties
DefaultFormatString
Gets or Sets the format string that is applied to group expressions that have no explicitly specified format string.
Declaration
public string DefaultFormatString { get; set; }
Property Value
System.String
|
Expression
String representation of the GroupBy expression. See Remarks for details.
Declaration
public override string Expression { get; set; }
Property Value
System.String
|
Overrides
Remarks
Create group-by expressions, using the following expression syntax:
fieldname[ as alias] [format "..."]|aggregate(fieldname|alias)[as alias][, ...]
Group By fieldname|alias [ASC|DESC]
Where:
fieldname: name of any field from the DataSource
alias: alias string. This cannot contain blanks or other reserved symbols like
',', '.' etc.
aggregate: any of - min, max, sum, count, last, first etc (the same as
in GridAggregateFunction enumeration)
formatstring identical to the one used with string.Format, where the
first argument is the field name or the alias and the second one is the actual
value. The default value is "{0}: {1}"
Example: Country, City, count(Country) Items, ContactName Group By
Country, City desc
Examples
Country, City, count(Country) Items, ContactName Group By Country, City desc
Country, City, count(Country) Items, ContactName Group By Country, City desc
GroupByFields
Gets a collection of GridGroupByField objects that form the grouping clause. Standing on the right side of the "Group By" clause
Declaration
public GridGroupByFieldCollection GroupByFields { get; }
Property Value
GridGroupByFieldCollection
|
Index
Gets the index of the expression if added in a GridGroupByExpressionCollection
Declaration
public int Index { get; }
Property Value
System.Int32
integer, representing the index of the collection ni GridGroupByExpressionCollection. |
SelectFields
Gets a collection of SelectField objects (field names, aggregates etc.) that form the "Select" clause. Standing on the left side of the "Group By" clause.
Declaration
public GridGroupByFieldCollection SelectFields { get; }
Property Value
GridGroupByFieldCollection
|
Methods
ContainsSameGroupByField(GridGroupByExpression)
Checks if the given expression contains same Group-By field as this one.
Declaration
public bool ContainsSameGroupByField(GridGroupByExpression expression)
Parameters
GridGroupByExpression
expression
Expression to check |
Returns
System.Boolean
true if the expression already contains this GroupByField, otherwise false. |
Remarks
Use this function to determine if two expressions seem to produce the same set of results
CopyFrom(GridGroupByExpression)
Copies from the passed GridGroupByExpression.
Declaration
public void CopyFrom(GridGroupByExpression expression)
Parameters
GridGroupByExpression
expression
The expression. |
Equals(Object)
Determines whether the specified System.Object is equal to the current System.Object.
Declaration
public override bool Equals(object obj)
Parameters
System.Object
obj
The object to compare with the current object. |
Returns
System.Boolean
true if the specified System.Object is equal to the current System.Object; otherwise, false. |
Overrides
GetHashCode()
Serves as a hash function for a particular type.
Declaration
public override int GetHashCode()
Returns
System.Int32
A hash code for the current System.Object. |
Overrides
IsSame(GridGroupByExpression)
Compares the current expression against the expression set as parameter and check if both expressions contain field with the same name.
Declaration
public bool IsSame(GridGroupByExpression expression)
Parameters
GridGroupByExpression
expression
expression to check against this expression |
Returns
System.Boolean
true if both expressions contain field with the same name, otherwise false. |
Parse(String)
Calls GridGroupByExpression(expression)
Declaration
public static GridGroupByExpression Parse(string expression)
Parameters
System.String
expression
|
Returns
GridGroupByExpression
|
ToString()
The same as the Expression property
Declaration
public override string ToString()
Returns
System.String
the string representation of the expression. |