Showing posts with label rdl. Show all posts
Showing posts with label rdl. Show all posts

Monday, March 12, 2012

Interactive sort in a matrix

I've modified the RDL from http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=525433&SiteID=1 to illustrate the problem I am having setting Interactive Sorts on columns in a Matrix. Using the rdl below you'll see that the 2 interactive sorts in the matrix corner named Cols and Rows are working well. My problem is in adding the Interactive Sorts to the individual CompanyName columns. I’d like to be able to click on a CompanyName and have the CategoryName (rows) sort by the Quantities shown for the clicked CompanyName. Any help in correcting the rdl below would be appreciated.

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<DataSources>
<DataSource Name="Northwind">
<DataSourceReference>Northwind</DataSourceReference>
<rd:DataSourceID>30d8ee62-a72d-48fa-ad77-66fdebc3f620</rd:DataSourceID>
</DataSource>
</DataSources>
<BottomMargin>1in</BottomMargin>
<RightMargin>1in</RightMargin>
<rd:DrawGrid>true</rd:DrawGrid>
<InteractiveWidth>8.5in</InteractiveWidth>
<rd:SnapToGrid>true</rd:SnapToGrid>
<Body>
<ReportItems>
<Matrix Name="matrix1">
<MatrixColumns>
<MatrixColumn>
<Width>1in</Width>
</MatrixColumn>
</MatrixColumns>
<RowGroupings>
<RowGrouping>
<Width>1.5in</Width>
<DynamicRows>
<ReportItems>
<Textbox Name="CategoryID">
<rd:DefaultName>CategoryID</rd:DefaultName>
<ZIndex>1</ZIndex>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<FontSize>8pt</FontSize>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Fields!CategoryName.Value</Value>
</Textbox>
</ReportItems>
<Grouping Name="matrix1_RowGroup1">
<GroupExpressions>
<GroupExpression>=Fields!CategoryID.Value</GroupExpression>
</GroupExpressions>
</Grouping>
</DynamicRows>
</RowGrouping>
</RowGroupings>
<ColumnGroupings>
<ColumnGrouping>
<DynamicColumns>
<ReportItems>
<Textbox Name="CompanyName">
<rd:DefaultName>CompanyName</rd:DefaultName>
<ZIndex>2</ZIndex>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<FontSize>8pt</FontSize>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<UserSort>
<SortTarget>matrix1_CompanyName</SortTarget>
<SortExpression>=Fields!Quantity.Value</SortExpression>
</UserSort>
<Value>=Fields!CompanyName.Value</Value>
</Textbox>
</ReportItems>
<Grouping Name="matrix1_CompanyName">
<GroupExpressions>
<GroupExpression>=Fields!CompanyName.Value</GroupExpression>
</GroupExpressions>
</Grouping>
</DynamicColumns>
<Height>0.5in</Height>
</ColumnGrouping>
</ColumnGroupings>
<DataSetName>DataSet1</DataSetName>
<Width>2.5in</Width>
<Corner>
<ReportItems>
<Rectangle Name="rectangle1">
<ReportItems>
<Textbox Name="textbox12">
<Top>0.25in</Top>
<ZIndex>1</ZIndex>
<Width>0.75in</Width>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<FontSize>8pt</FontSize>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<UserSort>
<SortExpression>=Fields!CategoryName.Value</SortExpression>
<SortExpressionScope>matrix1_RowGroup1</SortExpressionScope>
</UserSort>
<Value>Rows</Value>
</Textbox>
<Textbox Name="textbox11">
<Left>0.75in</Left>
<rd:DefaultName>textbox11</rd:DefaultName>
<Style>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<FontSize>8pt</FontSize>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Height>0.25in</Height>
<UserSort>
<SortExpression>=Fields!CompanyName.Value</SortExpression>
<SortExpressionScope>matrix1_CompanyName</SortExpressionScope>
</UserSort>
<Value>Cols</Value>
</Textbox>
</ReportItems>
<ZIndex>3</ZIndex>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
</Style>
</Rectangle>
</ReportItems>
</Corner>
<MatrixRows>
<MatrixRow>
<Height>0.25in</Height>
<MatrixCells>
<MatrixCell>
<ReportItems>
<Textbox Name="Quantity">
<rd:DefaultName>Quantity</rd:DefaultName>
<Style>
<BorderStyle>
<Default>Solid</Default>
</BorderStyle>
<TextAlign>Right</TextAlign>
<PaddingLeft>2pt</PaddingLeft>
<PaddingBottom>2pt</PaddingBottom>
<FontSize>8pt</FontSize>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
</Style>
<CanGrow>true</CanGrow>
<Value>=Sum(Fields!Quantity.Value)</Value>
</Textbox>
</ReportItems>
</MatrixCell>
</MatrixCells>
</MatrixRow>
</MatrixRows>
</Matrix>
</ReportItems>
<Height>0.75in</Height>
</Body>
<rd:ReportID>87afdd90-7b33-49bc-8880-0df212c6637a</rd:ReportID>
<LeftMargin>1in</LeftMargin>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<CommandText>SELECT TOP 300 Products.ProductName, Products.UnitPrice, Customers.CompanyName, [Order Details].Quantity, Categories.CategoryName,
Products.CategoryID
FROM Products INNER JOIN
[Order Details] ON Products.ProductID = [Order Details].ProductID INNER JOIN
Orders ON [Order Details].OrderID = Orders.OrderID INNER JOIN
Customers ON Orders.CustomerID = Customers.CustomerID INNER JOIN
Categories ON Products.CategoryID = Categories.CategoryID</CommandText>
<DataSourceName>Northwind</DataSourceName>
</Query>
<Fields>
<Field Name="ProductName">
<rd:TypeName>System.String</rd:TypeName>
<DataField>ProductName</DataField>
</Field>
<Field Name="UnitPrice">
<rd:TypeName>System.Decimal</rd:TypeName>
<DataField>UnitPrice</DataField>
</Field>
<Field Name="CompanyName">
<rd:TypeName>System.String</rd:TypeName>
<DataField>CompanyName</DataField>
</Field>
<Field Name="Quantity">
<rd:TypeName>System.Int16</rd:TypeName>
<DataField>Quantity</DataField>
</Field>
<Field Name="CategoryName">
<rd:TypeName>System.String</rd:TypeName>
<DataField>CategoryName</DataField>
</Field>
<Field Name="CategoryID">
<rd:TypeName>System.Int32</rd:TypeName>
<DataField>CategoryID</DataField>
</Field>
<Field Name="RowTotal">
<Value>=Fields!Quantity.Value</Value>
</Field>
</Fields>
</DataSet>
</DataSets>
<Code />
<Width>6.50001in</Width>
<InteractiveHeight>11in</InteractiveHeight>
<Language>en-US</Language>
<TopMargin>1in</TopMargin>
</Report>

Clicking on a column header to sort the rows is not supported. Because an end-user sort on a column header means you want to sort all details (when the SortExpressionScope is detail scope) or all inner groups (that correspond to the SortExpressionScope if it's not detail) under that column. Since the matrix row hierarchy is not under the columns, this would be an invalid scenario.

Sunday, February 19, 2012

Integrating Rdl to webapplication with parameter passing

<p>

Hi,

i was created rdl and deployed it rdl is working fine and asked parameter prompt and i gave the value report is generated in rdl.

and i was Integrated to Reportviewer in my web application all things are ok.

But how to set the parameter in reportviewer.

could any one help to me.

regards

kumar

</p>

this is easy

First it is necessary to ccreate aReportParameter object (be sure you have a reference toMicrosoft.Reporting.WebForms).The contructor takes two string parameters one for the Name and one forthe Value. A new parameter would look like the code below.

ReportParameter myReportParameter = new ReportParameter("Id",
Request.QueryString["Id"]);

Next, parameters on the ReportViewer are set using theSetParameters method. It takes an array of ReportParameter, so you would have syntax like the following.

MyReportViewer.ServerReport.SetParameters(
new ReportParmeter[] { myReportParameter });

Integrating Rdl to webapplication with parameter passing

Hi,

i was created rdl and deployed it rdl is working fine and asked parameter prompt and i gave the value report is generated in rdl.

and i was Integrated to Reportviewer in my web application all things are ok.

But how to set the parameter in reportviewer.

could any one help to me.

regards

kumar

this is easy

First it is necessary to ccreate aReportParameter object (be sure you have a reference toMicrosoft.Reporting.WebForms).The contructor takes two string parameters one for the Name and one forthe Value. A new parameter would look like the code below.

ReportParameter myReportParameter = new ReportParameter("Id",
Request.QueryString["Id"]);

Next, parameters on the ReportViewer are set using theSetParameters method. It takes an array of ReportParameter, so you would have syntax like the following.

MyReportViewer.ServerReport.SetParameters(
new ReportParmeter[] { myReportParameter });

Integrating Rdl to webapplication with parameter passing

Hi,

i was created rdl and deployed it rdl is working fine and asked parameter prompt and i gave the value report is generated in rdl.

and i was Integrated to Reportviewer in my web application all things are ok.

But how to set the parameter in reportviewer.

could any one help to me.

regards

kumar

this is easy

First it is necessary to ccreate aReportParameter object (be sure you have a reference toMicrosoft.Reporting.WebForms).The contructor takes two string parameters one for the Name and one forthe Value. A new parameter would look like the code below.

ReportParameter myReportParameter = new ReportParameter("Id",
Request.QueryString["Id"]);

Next, parameters on the ReportViewer are set using theSetParameters method. It takes an array of ReportParameter, so you would have syntax like the following.

MyReportViewer.ServerReport.SetParameters(
new ReportParmeter[] { myReportParameter });

|||

Thanks lot Tamer Fathy you are nice and simply guide to me

It is working fine once again Thanks lot

regards

kumar

|||

Mr. Tamer,

How do I pass 2 or more parameters to Report ??

Thanks,

Kusno

|||

You welcomeSmile,

you can easily do this as the report parameters are list

ReportParameter(ReportParameterName, Value);

I.e.

string strTime = System.DateTime.Now.ToShortTimeString();

RptParameters[0] =
new Microsoft.Reporting.WebForms.ReportParameter("ReportParameterName",Value);
RptParameters[1]=
new Microsoft.Reporting.WebForms.ReportParameter("ReportParameterName",Value);

 
and so on 

|||

Yes, it works....Yes

Thanks a lot man.