Thursday, October 1, 2009
Apply Criteria on XPCollection
CriteriaOperator criteria = new BinaryOperator("Age", 30, BinaryOperatorType.Greater);
CriteriaOperator criteria = CriteriaOperator.Parse("Age > 30");
xpCollection1.Criteria = criteria;
CriteriaOperator filter = CriteriaOperator.Parse("Age > 30 AND Age < 40");
xpCollection1.Filter = filter;
gridControl1.DataSource = new XPCollection(Session.DefaultSession, typeof(MyObject),
new BinaryOperator("UnitPrice", filterValue, BinaryOperatorType.GreaterOrEqual));
xpCollection1.Filter = new InOperator("Name", new string[] {"John", "Mike", "Nick"});
CriteriaOperator criteria1 = CriteriaOperator.Parse(
"Iif(Field1 == 100, Field1, Field2) > 1000");
XPCollection collection1 = new XPCollection(typeof(MyObject), criteria1);
class MyObject : XPObject {
decimal unitPrice;
public decimal UnitPrice {
get { return unitPrice; }
set { unitPrice = value; }
}}
// Select MyObject objects that match the specified criteria.
decimal filterValue = 20;
gridControl1.DataSource = new XPCollection(Session.DefaultSession, typeof(MyObject),
new BinaryOperator("UnitPrice", filterValue, BinaryOperatorType.GreaterOrEqual));
CriteriaOperator filter = new BetweenOperator("Age", 20, 30);
xpCustomers.Filter = filter;
// Retrieves a collection of the Contact objects which match the criteria that represents
// the logical expression (DefaultAddress.City <> "Chicago").
XPCollection collection = new XPCollection(typeof(Contact),CriteriaOperator.Parse("DefaultAddress.City != 'Chicago'")
// Retrieves a collection of the Contact objects which match the criteria that represents
// the logical expression (DefaultAddress.City <> "Chicago" AND not (Company is null)).
XPCollection collection = new XPCollection(typeof(Contact),
CriteriaOperator.Parse("DefaultAddress.City != 'Chicago' AND Company is not null")
// Retrieves the Contact objects that contain an address,
// and the city which is given in the address is the same as the person's city.
// The "^" symbol represents a reference to the Owner object,
//The '^' character is used to refer to the parent in a parent-child relationship. The parent relationship traversal operator allows you to access parent objects in expressions written in the context of a child.
// the parent object of the Locations collection.
XPCollection collection = new XPCollection(typeof(Contact),
new ContainsOperator("DefaultAddress.Owner.Locations",
new BinaryOperator(
new OperandProperty("City"), new OperandProperty("^.DefaultAddress.City"),
BinaryOperatorType.Equal
)
)
// Represents the Person class which contains account information.
public class Person: XPObject {
[Association("PersonAccounts", typeof(Account))]
public XPCollection Accounts {
get { return GetCollection("Accounts"); }
}
}
// Represents the Account class which contains the amount in the account.
public class Account: XPObject {
[Association("PersonAccounts")]
public Person Owner;
public int Amount;
}
XPCollection collection = new XPCollection(typeof(Person),
CriteriaOperator.Parse("Accounts.Sum(Amount) < 100")
XPCollection collection = new XPCollection(typeof(Person),
CriteriaOperator.Parse("Accounts[Amount = 0].Count == 1")
CriteriaOperator.Parse("[FirstName] Like 'A%'");
CriteriaOperator.Parse(String.Format("[Address1.City] = '{0}'",City));
CriteriaOperator.Parse("[IsGlobal] = true");
Subscribe to:
Post Comments (Atom)
Mat Table Angular
Mat Table in Angular Mat table is used to display data . its a material designed styled data-table . For using Material Table MatTableMo...
-
CriteriaOperator criteria = new BinaryOperator("Age", 30, BinaryOperatorType.Greater); CriteriaOperator criteria = CriteriaOperato...
-
SortingCollection sc = new SortingCollection(); sc.Add (new SortProperty("field on which you want to sort",DevExpress.Xpo.DB.Sorti...
-
Here ItemName will be Enable/Disable According to IsApplicable Property Assembly: DevExpress.XtraLayout; DevExpress.ExpressApp.Win.Layou...
No comments:
Post a Comment