Thank you so much John. Here is my code snippet for anyone who will be in need for future reference...(by the way Frans could you please provided a simple code sample of creating PK in the code?)
IDataAccessAdapter adapter = DataAccessAdapterFactory.GetDataAdapter();
ResultsetFields fields = new ResultsetFields(2);
fields.DefineField(TableAFieldIndex.ColumnA, 0, "ColumnA");
fields.DefineField(TableBFieldIndex.ColumnB, 1, "ColumnB");
//Add Relations
IRelationPredicateBucket bucket = new RelationPredicateBucket();
// define custom relation
IEntityRelation CustomRelation = new EntityRelation(RelationType.OneToOne);
CustomRelation.AddEntityFieldPair(EntityFieldFactory.Create(TableAFieldIndex.ColumnA),
EntityFieldFactory.Create(TableBFieldIndex.ColumnA));
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(TableAFieldIndex.ColumnB, ComparisonOperator.Equal, sessionCode));
bucket.PredicateExpression.Add(PredicateFactory.CompareValue(TableBFieldIndex.ColumnName, ComparisonOperator.Equal, strColumnName));
// add it to the relations collection
bucket.Relations.Add(CustomRelation);
//Add Grouping
IGroupByCollection groupByClause = new GroupByCollection();
groupByClause.Add(fields[0]);
groupByClause.Add(fields[1]);
//Add Sorting
ISortExpression sorter = new SortExpression(SortClauseFactory.Create(TableBFieldIndex.ColumnB, SortOperator.Ascending));
DataTable dynamicList = new DataTable();
try
{
adapter.FetchTypedList(fields, dynamicList, bucket, 0, sorter, true, groupByClause);
}
catch (Exception ex)
{
throw new Exception( "There was a problem retrieving data from the TableA and TableB table: " + ex.Message.ToString(), ex.InnerException );
}
DataView dv = new DataView(dynamicList);
return dv;