Loading ...

Filtering results in Report.rdlc, HELP

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  web forms / data controls   » Filtering results in Report.rdlc, HELP

Filtering results in Report.rdlc, HELP

Posts under the topic: Filtering results in Report.rdlc, HELP

Posted: 5/25/2011

Lurker 85  points  Lurker
  • Joined on: 5/25/2011
  • Posts: 17

I am displaying data in a report.

I want to filter the data in the report based on the selected value from ta dropdown menu.

This now I have done this but seems like data is not getting affected in the report and "Amount Paid" field is empty for all t he field even though there are value saved in the database for this field.

 

<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:ObjectDataSource ID="ObjectDataSource3" runat="server"
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
        TypeName="DropDownTableAdapters.YearTableTableAdapter">
    </asp:ObjectDataSource>
    <br />
    <br />
    Select Year
    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
        DataSourceID="ObjectDataSource3" DataTextField="Year_Of_Payment"
        DataValueField="Year_Of_Payment">
    </asp:DropDownList>
    <br />
    <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
        Font-Size="8pt" Height="11in" InteractiveDeviceInfos="(Collection)"
        WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" Width="8.5in">
        <LocalReport ReportPath="ReportTestDrop.rdlc">
            <DataSources>
                <rsweb:ReportDataSource DataSourceId="ObjectDataSource2" Name="DataSet1" />
            </DataSources>
        </LocalReport>
    </rsweb:ReportViewer>
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server"
        OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
        TypeName="DataSet2TableAdapters.DataTable1TableAdapter">
        <SelectParameters>
            <asp:ControlParameter ControlID="DropDownList1" DefaultValue="-1"
                Name="YearPaayment" PropertyName="SelectedValue" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
        SelectMethod="GetData" TypeName="DataSet2TableAdapters.DataTable1TableAdapter">
    </asp:ObjectDataSource>

 

My ObjectDataSource3, I am using this SQL Command:

SELECT DISTINCT YearTable.Year_Of_Payment
FROM         MemberTable INNER JOIN
                      Payment_Table ON MemberTable.ID = Payment_Table.ID INNER JOIN
                      YearTable ON Payment_Table.YearID = YearTable.YearID
ORDER BY YearTable.Year_Of_Payment DESC

 

My ObjectDataSource2, I am using this SQL Command:

SELECT DISTINCT MemberTable.FirstName, MemberTable.LastName, MemberTable.City, MemberTable.State, Payment_Table.AmountPaid
FROM         MemberTable INNER JOIN
                      Payment_Table ON MemberTable.ID = Payment_Table.ID INNER JOIN
                      YearTable ON Payment_Table.YearID = YearTable.YearID
WHERE     (YearTable.Year_Of_Payment = @YearPaayment)

 

PLEASE HELP


Posted: 5/26/2011

Lurker 125  points  Lurker
  • Joined on: 5/24/2011
  • Posts: 9

hi Jeff ,

for DropDownList1 you have mentioned autopost back true, but not mentioned onselectedinexchanged event...

and in the onselectedinexchanged you have to pass the parameter @YearPaayment to ObjectDataSource2.


Posted: 5/26/2011

Lurker 85  points  Lurker
  • Joined on: 5/25/2011
  • Posts: 17

Can you please show me in code how to do that ? I don't know how to pass parameter.


Posted: 5/26/2011

Lurker 85  points  Lurker
  • Joined on: 5/25/2011
  • Posts: 17

Here is the complete description of my report.

Here is the structure of my tables:

This is the structure of my 3 tables:

CREATE TABLE [dbo].[MemberTable](
[ID] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [nvarchar](max) NULL,
[LastName] [nvarchar](max) NULL,
[Address] [nvarchar](max) NULL,
[City] [nvarchar](max) NULL,
[State] [nvarchar](max) NULL,
[Zip] [nvarchar](max) NULL,
[POBox] [nvarchar](max) NULL,
CONSTRAINT [PK_MemberTable] PRIMARY KEY CLUSTERED

----------------------
CREATE TABLE [dbo].[Payment_Table](
[PaymentID] [int] IDENTITY(1,1) NOT NULL,
[ID] [int] NOT NULL,
[YearID] [int] NOT NULL,
[SuggestedDonation] [money] NULL,
[AmountPaid] [money] NULL,
[PaymentDate] [datetime] NULL,
[Status] [bit] NULL,
CONSTRAINT [PK_Payment_Table] PRIMARY KEY CLUSTERED

------------------

CREATE TABLE [dbo].[YearTable](
[YearID] [int] IDENTITY(1,1) NOT NULL,
[Year_Of_Payment] [nvarchar](50) NULL,
CONSTRAINT [PK_YearTable] PRIMARY KEY CLUSTERED

 

I want to create a report in which I should be able display:

ID, First Name, Last Name, Address, POBox, State, City, AmountPaid

Want to add filters with 2  dropdown menus:

Filter Option Based on "Year": Choose Year (for which I want to display the report - year will be coming from database from yearTable)

Second Filter : Based on "Status" - Paid/Un-paid/All (In datbase, it will be true/false or 1 or 0)

Right now I am developing project on my local machine but database is still on the server and as soon as I am able to create  this report I will transfer all the pages and reports on the server.

Please let me know if you need more information. thank you

Here's the screenshot I designed to explain what I am looking for:

1) Select Year

2) Status (Paid / Un-paid / All)



Posted: 5/27/2011

Lurker 85  points  Lurker
  • Joined on: 5/25/2011
  • Posts: 17

anyone ?


Posted: 5/30/2011

Lurker 85  points  Lurker
  • Joined on: 5/25/2011
  • Posts: 17

please help this newbie ?


Posted: 6/26/2011

Professional 8505  points  Professional
  • Joined on: 5/3/2010
  • Posts: 391
  Answered
Page 1 of 1 (7 items)