I realised after looking into it that the filter I was applying was too simple.
I actually have a RelationPredicateBucket that defines my relation for "sites" that belong to "site groups" - by adding the relationship to the bucket, and then specifying the filter (code below)
RelationPredicateBucket buck = new RelationPredicateBucket();
buck.Relations.Add(SiteEntity.Relations.Group_SiteEntityUsingSite_ID);
buck.PredicateExpression.Add(GeneratedGeneric.FactoryClasses.PredicateFactory.CompareValue
(GeneratedGeneric.Group_SiteFieldIndex.AllowDeny, ComparisonOperator.Equal, "A"));
buck.PredicateExpression.Add(GeneratedGeneric.FactoryClasses.PredicateFactory.CompareValue
(GeneratedGeneric.Group_SiteFieldIndex.Group_ID, ComparisonOperator.Equal, groupID));
What I need to do is execute my GetSclar using this RelationPredicateBucket, but as far as I can work out, I am only able to specify a predicate clause....
However.....having played around with this, I finally got the folllowing to work, is this what you would have suggested?
(using bucket defined above)
System.Data.DataTable dt = new System.Data.DataTable();
GeneratedGeneric.HelperClasses.ResultsetFields fields = new Entropy.Envoy.GeneratedGeneric.HelperClasses.ResultsetFields(1);
fields.DefineField(SiteFieldIndex.ID, 0, "ID");
fields[0].AggregateFunctionToApply = AggregateFunction.CountRow;
adaptor.FetchTypedList(fields, dt, buck, 0, null, true, null);
return dt.Rows[0][0];