I found a thread where someone suggested using the following:
Code: Select all
To change sorting see below:
DataBand1.Sort = new string[2]
{
"ASC",
"Name"
};
Here is a toned down version of my code block for simplicity sake:
Code: Select all
Stimulsoft.Report.StiReport rptPreview;
Stimulsoft.Report.Components.StiDataBand bndPreview;
Stimulsoft.Report.Dictionary.StiSqlSource tsPreview;
rptPreview = LoadReport(_reportID);
bndPreview = MasterDatabandGet(rptPreview); //Retreives the Master databand for the loaded report
bndPreview.Sort = new string[2]
{
"DESC"
,"WorkOrderNumber"
};
tsPreview = rptPreview.DataSources[bndPreview.DataSource.Name] as Stimulsoft.Report.Dictionary.StiSqlSource;
// Need to pass WHERE and ORDER BY Clause
BuildWhereClause(ref tsPreview);
//SortBuild(ref tsPreview);
frmReportViewer frmX = new frmReportViewer();
frmX.MdiParent = this.MdiParent;
frmX.View(rptPreview, _reportID);
break;
Code: Select all
tsPreview.SqlCommand += " WHERE column = value "
tsPreview.SqlCommand += " ORDER BY column ASC"
I noticed that I instantiate bndPreview, then change the Sort, then use the name to reference which DataSource to use for tsPreview. But no where do I add it to the report itself. What am I missing here? Please help. Thanks.