goose wrote:
instead of sending null in the las parameter of the new FieldCompareSetPredicate send an valid IPredicate (i.e. the filter you want to apply e.g. WHERE foo.field_c = 'SOME VALUE' ). In order to create more complex sub querys please see the several constructor overloads of FieldCompareSetPredicate class.
Thanks Goose. Upon looking futher I seen where this topic existed in the help docs. I could have swarn that I looked for that. I guess I should've looked harder.
Anyway I wanted to post the code for anyone else who may be interested.
if (functionalGroupId.HasValue)
{
FunctionalLeadsTypedList leads = new FunctionalLeadsTypedList();
IRelationPredicateBucket bucket = leads.GetRelationInfo();
bucket.PredicateExpression.Add(FunctionalLeadFields.FunctionalGroupId == functionalGroupId);
ISortExpression sorter = new SortExpression(UserFields.LastName | SortOperator.Ascending);
bucket.PredicateExpression.Add(new FieldCompareSetPredicate(FunctionalLeadFields.UserId,
null, ProjectUserFields.UserId, null,
SetOperator.In, (ProjectUserFields.ProjectId == projectId)));
using (DataAccessAdapter adapter = DBAdapter.NewDataAdapter)
{
adapter.FetchTypedList(leads.GetFieldsInfo(), leads, bucket, 0, sorter, false);
}
return leads;
}
else
{
return new FunctionalLeadsTypedList();
}