Problem with multi-hierachy object dataSource
Posted: Tue Jun 23, 2009 12:44 am
Hi All,
I am binding the report with object datasourse as shown below:
Here 'ReportCMHospAssignList' has alias name 'MySource' and members ('TlId','TlName' and 'TlTerritoryList'). Where 'TlTerritoryList' is again a user defined type.
'TlTerritoryList' has members ('TerId' and 'TerName'). So there is two level hierachy.
When I view this report with stimulsoft designer, then there comes two data sources (named 'MyDataSource' and 'MySource_TlTerritoryList') in the 'Dictionary' tab.
When I use any member from 'MySource', then report is rendered successfully and gives expected result.
But when I use any member of 'MySource_TlTerritoryList', then there comes following error:
As you can see the problem comes with just two levels of hierarchy of business objects, while I've to drill down to 4 levels of hierarchy as well.
I did lot of RnD and still stuck with this issue. Please give me the solution asap to fix the above issue.
I am binding the report with object datasourse as shown below:
Code: Select all
StiReport report = new StiReport();
report.Load(Server.MapPath("TestReports/" + Session["FileName"].ToString()));
StiOptions.Dictionary.BusinessObjects.MaxLevel = 2;
string[] references = report.ReferencedAssemblies;
// Converting the the array to a collection
List newReferences = references.ToList();
// Add your Assembly to the list
newReferences.Add("MyProject.BusinessLib.dll");
newReferences.Add("Csla.dll");
// Reset the array of referenced assembly with the converted collection
report.ReferencedAssemblies = newReferences.ToArray();
BusinessLib.ReportCMHospAssignList rha = BusinessLib.ReportCMHospAssignList.GetReportCMHospAssignList();
report.RegData("MySource", rha);
report.Dictionary.DataSources.Clear();
report.Dictionary.Synchronize();
try
{
report.Dictionary.Connect();
report.Render();
StiReportResponse.ResponseAsPdf(this.Page, report, true);
}
catch (Exception ex)
{
ex = null;
}
'TlTerritoryList' has members ('TerId' and 'TerName'). So there is two level hierachy.
When I view this report with stimulsoft designer, then there comes two data sources (named 'MyDataSource' and 'MySource_TlTerritoryList') in the 'Dictionary' tab.
When I use any member from 'MySource', then report is rendered successfully and gives expected result.
But when I use any member of 'MySource_TlTerritoryList', then there comes following error:
Code: Select all
c:\Documents and Settings\HSS-116\aspnet~1.hss\Local Settings\Temp\zwbmx98o.0.cs(64,40) : error CS0103: The name 'MySource_TlTerritoryList' does not exist in the current context
I did lot of RnD and still stuck with this issue. Please give me the solution asap to fix the above issue.