Query.QueryOperator.AND_Field We were using this method in Tridion R5.3 VBscript templates and it worked well. Recently , while migrating to Tridion 2011
In SDL Tridion 2011 Content Delivery, you create a Query
object and add a Criteria
object to it using the setCriteria
method. The Query
object accepts one Criteria object ONLY, but that Criteria
object can in turn reference other Criteria
objects in a tree structure.
For a good example of creating a Query filter using both AND and OR operators, see Creating a filter in the SDL Tridion 2011 SP1 documentation in SDL LiveContent.
// Schema has ID of either 511 (Article) or 34 (Press Release).
ItemSchemaCriteria IsArticle = new ItemSchemaCriteria(511);
ItemSchemaCriteria IsPressRelease = new ItemSchemaCriteria(34);
Criteria IsArticleOrPressRelease = CriteriaFactory.Or(IsArticle, IsPressRelease);
// Type of the item is 16 (Component).
ItemTypeCriteria IsComponent = new ItemTypeCriteria(16);
// Both of the above conditions must be true
Criteria AllCriteria = CriteriaFactory.And(IsArticleOrPressRelease, IsComponent);
// Add these criteria to a query
Query MyQuery = new Query();
MyQuery.Criteria = AllCriteria;