I have a problem when listing clubs. I want to list clubs that are approved, not hidden, sorted on creationdate and with a specific attribute-value. I.e the same as this method but with the addition a specific attribut-value. ClubCollection clubs = ClubHandler.GetClubs(ClubApproval.Approved, ClubHideStatus.NotHidden, page, ucClubs.PageSize, out totalItems, new ClubSortOrder(ClubSortField.Created, SortingDirection.Descending));
If I just filter the resultcollection I will get problems with the paging when "totalitems" and "pagesize" attributes are already set.
I was thinking that a ClubQuery can be the solution to my problem but I don't know how to write taht kind of query with attributes and sorting.
I have an example here that might help. but please note that I did it more or less "freehand" from memory so I have not tested it.
ClubQuery clubQuery = new ClubQuery();
clubQuery.IsApproved = new BooleanCriterion();
clubQuery.IsApproved.Value = true;
clubQuery.IsHidden = new BooleanCriterion();
clubQuery.IsHidden.Value = false;
StringCriterion strCriterion = new StringCriterion();
strCriterion.Value = "MyAttributeValue";
clubQuery["MyAttribute"] = strCriterion;
clubQuery.Created = new DateTimeCriterion();
clubQuery.OrderBy.Add(new CriterionSortOrder(clubQuery.Created, SortingDirection.Descending));
ClubCollection clubCollection = QueryHandler.GetQueryResult<Club, ClubCollection>(clubQuery,page,ucClubs.PageSize, out totalItems);
Many thanks, Claus!