CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2016
    Posts
    3

    Show records for same date plus additional filter

    Hi,

    New to the forum here and need some assistance. Using Crystal Reports v14 and I have created an existing report in the past that needs to be modified.

    Currently, the report has two group headers: Patient, Completed Date
    Details section contains other patient and exam data fields

    Record Selection allows user to select the facility, department, completed date range (from & to parameters)
    Group Selection has DistinctCount({maintable.dept}, {maintable.completed_date}, "daily"} > 1

    These fields are basically all on the same view so it's where I'm focusing the modifications on.

    This seems to be working perfectly fine where the report will display a list of patients who have more than one exam performed on the same day. Any patients who only had one exam done will not be shown.

    The problem I'm having now is modifying it so there is an "exams" parameter. The problem is that I don't want to filter to only show that exam. I want it to show other exams that were performed with that exam on the same date. So basically, filter for multiple exams performed on the same day for patients who also have those exams performed. If the exam parameter is left blank, show all (which my current report does already). I want to use multiple exams (comma separated) if possible. I have that setup already in record selection but just don't know how to apply single or multiple exams to be "filtered" and used.

    Thanks in advance for any assistance.

  2. #2
    Join Date
    Aug 2007
    Posts
    179

    Re: Show records for same date plus additional filter

    I would suggest you use a sub-report. The sub-report would be created from your existing report. You need a container report to house your existing report that has the exam parameter. When the exam parameter is blank, your sub-report would return all exams. When the exam parameter is not blank, your sub-report would return all exams performed on the same date as the exam that is included in the parameter. You may want to read over the help files on connecting a sub-report to a main report by linking parameters, and also read up on the use of shared variables.

  3. #3
    Join Date
    Apr 2016
    Posts
    3

    Re: Show records for same date plus additional filter

    Thanks for the reply. By container report, do you mean a subreport? I have worked with them before and think I know where this is heading. Actually tried using a subreport before posting here initially.

    The problem I seem to be running into is that when I use the exam parameter, I don't want it to just filter for the specific exam or exams. I want it to show patients who have those exams PLUS any other exam performed on the same day. Let's say a patient has the following exams on the below dates:

    5/17/2016
    Exam1
    Exam2
    Exam3

    5/15/2016
    Exam2
    Exam4
    Exam5

    5/1/2016
    Exam1
    Exam2
    Exam6

    If I enter date range 5/1/2016 to 5/31/2016 and enter "Exam1" for the exam parameter, I want it to return the data fields for the following:

    5/17/2016
    Exam1
    Exam2
    Exam3

    5/1/2016
    Exam1
    Exam2
    Exam6

    My report has the patient name, exam, etc. in the details section for those exams. The problem is that it's returning only:

    5/17/2016
    Exam1

    5/1/2016
    Exam1

    Thanks.

  4. #4
    Join Date
    Aug 2007
    Posts
    179

    Re: Show records for same date plus additional filter

    By container report I mean the main report that will house (contain) the sub-report. You basically will use the same report that returns your exams as the sub-report, with different input parameters. The "main" report will only show the exams you are interested in based on the input parameter. The sub-report will return all the exams a patient had. Then you pass parameters to the sub report for the date and the exam that was requested in the main report's parameter. The main report shows the requested exam, the sub-report shows all the exams. The parameters you pass to the sub-report limits the output of the sub-report to the date you are interested in, and suppresses the exam the main report already displayed.

  5. #5
    Join Date
    Apr 2016
    Posts
    3

    Re: Show records for same date plus additional filter

    Hi Ned,

    I tried doing this and I messed up somewhere. If you have the time, can you take a look at the attached report?

    Thanks.

    Kevin.
    Attached Files Attached Files
    Last edited by gk17; June 14th, 2016 at 10:02 AM.

  6. #6
    Join Date
    Aug 2007
    Posts
    179

    Re: Show records for same date plus additional filter

    Hello,
    I am not sure what you mean by 'messed up'. It looks like you have the same record selection formula in the sub report as in the main report. I don't have access to your data, but from the sample, I would think under the first row of the main report, you want the sub report to display only the exams for 3/15/2016 for the same patient. I think you would limit the sub report by passing in the exam date from the main report.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured