Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: filtering two subreports Post Reply Post New Topic
Author Message
pedroponting
Newbie
Newbie


Joined: 28 Apr 2008
Online Status: Offline
Posts: 6
Quote pedroponting Replybullet Topic: filtering two subreports
    Posted: 28 Apr 2008 at 10:15pm
This seems like madness to me, but here you are:

I have two subreports embedded in my main report. I filter the DataSet for a date range prior to viewing the report. The problem is that when I display the subreports, only one of them (the one I apply the filter to last) actually gets filtered. The other shows results for all dates.

Here's the code I'm using:

        private void crystalReportViewer1_Load(object sender, EventArgs e)
        {
           
            MainForm = (frmWorkReport)this.Owner;
            this.tasksTableAdapter.Fill(this.workreportDataSet.Tasks);
            this.staffTableAdapter.Fill(this.workreportDataSet.Staff);
            this.prioritiesTableAdapter.Fill(this.workreportDataSet.Priorities);
            this.projectsTableAdapter.Fill(this.workreportDataSet.Projects);
            this.KRAsTableAdapter.Fill(this.workreportDataSet.KRAs);
            tasksReport1.SetDataSource(workreportDataSet);
            FilterData();
        }
        private void FilterData()
        {
            string filter;
            filter = <snip>; //removed for simplicity's sake. The filter expression works fine

            tasksReport1.DataDefinition.RecordSelectionFormula = filter;

            ReportDocument srProj = tasksReport1.OpenSubreport("rptProjects");
            srProj.DataDefinition.RecordSelectionFormula = filter;

            ReportDocument srKRAs = tasksReport1.OpenSubreport("rptKRAs");
            srKRAs.DataDefinition.RecordSelectionFormula = filter;

        }

If I reverse the order of the filter assignments, then the  result is reversed. It is always the second subreport assigned a filter that gets successfully filtered. I can't filter both subreports at the same time!

I've got Brian's book since yesterday and searched it for any reference to this, but so far haven't found a solution. Help anyone?


Edited by pedroponting - 28 Apr 2008 at 10:15pm
------------
laziness is the father of invention
IP IP Logged
pedroponting
Newbie
Newbie


Joined: 28 Apr 2008
Online Status: Offline
Posts: 6
Quote pedroponting Replybullet Posted: 29 Apr 2008 at 4:52am
Sorry - this post should be on the CR for Visual Studio 2005 .NET forum.
------------
laziness is the father of invention
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.032 seconds.