CustomExpression Class
A custom aggregate expression that can be applied to a data column or group/sorting criteria.
Namespace: DevExpress.DataAccess.Sql
Assembly: DevExpress.DataAccess.v24.1.dll
NuGet Packages: DevExpress.DataAccess, DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap
Declaration
Remarks
The following example illustrates how to create a simple CustomExpression
. For general information on creating custom expressions, see Creating Criteria.
using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.Sql;
// ...
private SqlDataSource BindToData() {
// Create a data source with the required connection parameters.
Access97ConnectionParameters connectionParameters =
new Access97ConnectionParameters("../../Data/nwind.mdb", "", "");
SqlDataSource ds = new SqlDataSource(connectionParameters);
// Create a query and select a table.
SelectQuery query = new SelectQuery("MyQuery");
Table employeesTable = new Table() { Name = "Employees" };
query.Tables.Add(employeesTable);
// Create a custom expression.
CustomExpression fullName = new CustomExpression();
fullName.Expression = "[FirstName] + ' ' + [LastName]";
// Select a column and assign the expression to it.
Column column = new Column();
column.Expression = fullName;
column.Alias = "FullName";
query.Columns.Add(column);
// Add the query to the collection and return the data source.
ds.Queries.Add(query);
return ds;
}
Inheritance
Object
ExpressionBase
CustomExpression
See Also