Hi - I need to get a collection of question entities, which are filtered by certain user selected criteria (using the switch statement below). I think I've cracked them all except one: for the case "unanswered questions" I need the results of a Question left join Answer where the answer is absent (detected using AnswerId is null).
Can you tell me how to do this using the RelationPredicateBucket?
Thanks
EntityCollection<QuestionEntity> questions = new EntityCollection<QuestionEntity>(new QuestionEntityFactory());
// set up the common relationships & filters
RelationPredicateBucket bucket = _section.GetRelationInfoQuestions();
bucket.Relations.Add(QuestionEntity.Relations.AnswerEntityUsingQuestionID);
// add the filter dependent predicates
switch (ddlFilterQuestions.SelectedValue)
{
case "unanswered questions":
*** need question left join answer where answerid is null here ***
break;
case "guesstimates":
bucket.PredicateExpression.Add(AnswerFields.IsGuesstimate == 1);
break;
case "not sures":
bucket.PredicateExpression.Add(AnswerFields.AnswerPosition == UserControl_QuestionBase.CommonAnswer.NotSure);
break;
case "N/As":
bucket.PredicateExpression.Add(AnswerFields.AnswerPosition == UserControl_QuestionBase.CommonAnswer.NA);
}
GetAdapter().FetchEntityCollection(questions, bucket, 0, new SortExpression(QuestionFields.Position | SortOperator.Ascending));