Hi -
I'm not sure why this code doesn't work, I'm pretty sure it should do... note if I use the ADDWITHOR operator it returns correctly all the OR'd fields... if I use the ADDWITHAND I don't get any results back, even thou it definitely occurs correctly. Can anyone help, I'm stuck about how to achieve this.
cake.CollectionClasses.ItemCollection _cMasterItem = new cake.CollectionClasses.ItemCollection();
RelationCollection relationsToUse = new RelationCollection();
relationsToUse.Add(cake.EntityClasses.ItemEntity.Relations.TagOccuranceEntityUsingItemId);
relationsToUse.Add(cake.EntityClasses.TagOccuranceEntity.Relations.TagListEntityUsingTagId);
PredicateExpression _fItems = new PredicateExpression();
int _AddCount = 0;
foreach (string _tag in _searchByTags)
{
_AddCount++;
if (_AddCount == 1)
{
_fItems.Add(cake.HelperClasses.TagListFields.Tag == _tag.Trim());
}
else
{
_fItems.AddWithAnd(cake.HelperClasses.TagListFields.Tag == _tag.Trim());
}
}
_cMasterItem.GetMulti(_fItems, 0, null, relationsToUse);
Maybe there's a better way of doing this, but I couldn't figure it out.
I tried using compare fieldrange predicate, but this uses an OR and there doesn't seem to be any why to make it use ANDs.
I throw myself at your mercy