Hi,
I am using v2.0 and I am building a Dynamic List but when I run the FetchTypedList command it generates and error saying
The column prefix 'Target_Demo2.dbo.CubeActivityUser' does not match with a table name or alias name used in the query
Target_Demo2 is the name of my database
CubeActivityUser is the name of the table
Code I am using (cut down to the essentials is)
ResultsetFields myFields = new ResultsetFields(1);
myFields.DefineField(CubeActivityUserFieldIndex.ActivityCount, 0, Count","CubeActivityUser",AggregateFunction.Sum);
IRelationPredicateBucket myBucket = new RelationPredicateBucket();
IGroupByCollection myGroupByClause = new GroupByCollection();
DataTable myDynamicList = new DataTable();
myAdapter.FetchTypedList(myFields, myDynamicList, myBucket, 0, null, true, myGroupByClause);
return myDynamicList;
You can see that I am trying to simply return the sum of values in a field called ActivityCount.
However if I extend the code to include a group by it works fine (again cut down):
ResultsetFields myFields = new ResultsetFields(2);
myFields.DefineField(CubeActivityUserFieldIndex.ActivityWeek, 0, "ActivityWeek");
myFields.DefineField(CubeActivityUserFieldIndex.ActivityCount, 1, "Count","CubeActivityUser",AggregateFunction.Sum);
IRelationPredicateBucket myBucket = new RelationPredicateBucket();
IGroupByCollection myGroupByClause = new GroupByCollection();
myGroupByClause.Add(myFields[0]);
DataTable myDynamicList = new DataTable();
myAdapter.FetchTypedList(myFields, myDynamicList, myBucket, 0, null, true, myGroupByClause);
return myDynamicList;
I cant understand why the second one works fine but the first one does not. Furthermore, when I copy the SQL statement generated into SQL Enterprise manager it works perfectly.
Please help
- no doubt I am doing something stupid!!