Monday, February 8, 2010

Additional column on Report Builder

When you are using Report Builder, an additional column may added automatically. This colunm is entity key of the data.

Grouping keys are definitely there by design. It is important to group on the keys to ensure consistency in results. This column are actually Base64 encoded smashed entity keys, basically your integer keys with a couple extra bits of information added, encoded as Base64 (in the case of composite keys, all the key column values are combined into this single string value). These should be used in your grouping expressions to ensure accurate grouping when other columns may overlap.

Friday, August 8, 2008

Anonymous access Report Manager


The problem is that when using Anonymous access, every person hitting that page will be under the Anonymous user context, and no one will have rights to administer Reporting Services through Report Manager. This is why we don't support using Anonymous access in Reporting Services.
In order to differentiate between users, we need to either disable Anonymous access or use a custom security extension. We have a sample using Forms Authentication:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/ufairs.asp

If the customer persists in wanting to use Anonymous access, this is a starting list:
1) Add the anonymous user to the System User role
2) Create an Item-level role with all of the tasks you want this user to be able to use, then assign the anonymous user to that role at the root level.
3) Check permissions for the anonymous user on folders that SRS uses:
- C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services (and subfolders)
- C:\\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET Files
- the temp folder for the anonymous user
There may be others as well.

Note that 1 & 2 can be accomplished through Report Manager only if Anonymous access is disabled and the logged-on user is a member of the System Administrator role.

Dynamical Chart in SQL Server Reporting Services 2005


Code Snippet
protected void btnViewReport_Click(object sender, EventArgs e)
{
Stream streamingReport;
//The .rdlc file is actually an XML document that structures how the report is to be built.
XmlDocument rdlcXML = new XmlDocument();
try
{
streamingReport = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ConsumerRaterReports.TransactionsByHour.rdlc");
rdlcXML.Load(streamingReport);
//Change out the Type of the chart in the XML document
XmlNodeList typeNodeList = rdlcXML.GetElementsByTagName("Type");
XmlNode typeNode = typeNodeList[0];

if (uxChartType.Items[uxChartType.SelectedIndex].Text == "")
typeNode.InnerText = "Line";
else
typeNode.InnerText = uxChartType.Items[uxChartType.SelectedIndex].Text;

//Reset the basic report information
ReportViewer1.Reset();
ReportViewer1.ProcessingMode = ProcessingMode.Local;
ReportDataSource newDataSource = new ReportDataSource();
newDataSource.DataSourceId = "ObjectDataSource1";
newDataSource.Name = "TransactionsByHour_vwGetConsumerStatsByHour";
ReportViewer1.LocalReport.DataSources.Add(newDataSource);
ReportViewer1.LocalReport.ReportPath = string.Empty;
ReportViewer1.LocalReport.LoadReportDefinition(new StringReader(rdlcXML.OuterXml));
ReportViewer1.LocalReport.Refresh();
}
finally
{
streamingReport.Close();
}

... (more code to set datasource and set report to visible)