We've extended the IDataReader class to allow the ability to select data from multiple datasources as DataTables and then combine the multiple DataTables into one single DataTable.
Here's our internal object array that holds the values being returned to SSRS
-
internal object[] m_cols;
-
Here's our IDataReader.Read() implementation where we attempt to sort our DataTable after the combination takes place.
-
bool Microsoft.ReportingServices.DataProcessing.IDataReader.Read()
{
DataView dv = new DataView(masterTable);
dv.Sort = "CLIENT ASC";
int colCounter = 0;
while (rowCounter < dv.Table.Rows.Count)
{
if (dv.Table.Rows != null)
{
foreach (DataColumn dc in dv.Table.Columns)
{
m_cols[colCounter] = dv.Table.Rows[rowCounter].ItemArray[colCounter].ToString();
colCounter++;
}
rowCounter++;
return true;
}
}
return false;
}
Here's our IDataReader.GetValue() implemtation that returns data to the SSRS Report Designer
-
object Microsoft.ReportingServices.DataProcessing.IDataReader.GetValue(int fieldIndex)
{
return m_cols[fieldIndex];
}
It's returning data to our SSRS designer, but it's not sorted..
I can't understand it...but it's pretty important that I get this figured out fast...
thanks
doug
> It's returning data to our SSRS designer, but it's not sorted..
Not sure what you mean with that. Does the original query specify an explicit sort order?
Note that even if the original dataset is not sorted, you can apply sorting directly in the report (e.g. on a data region or on a group) - but sorting the data directly in the dataset query generally yields better performance.
-- Robert
No comments:
Post a Comment