Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Report first record for each test Post Reply Post New Topic
Author Message
Beaster
Newbie
Newbie


Joined: 23 May 2019
Online Status: Offline
Posts: 2
Quote Beaster Replybullet Topic: Report first record for each test
    Posted: 28 May 2019 at 10:58am
Hello all,

I'm putting together a report that will ultimately be exported to CSV. Each product can go through a series of tests, and these tests may or may not be repeated. Test 1 must pass before test 2 is performed, and so on.

Here's an example of what I have:

Barcode      Test Name      Test Result
Barcode1      Test1           Result1
Barcode1      Test1           Result2
Barcode1      Test2           Result3
Barcode1      Test2           Result4
Barcode1      Test3           Result5
Barcode2....

And so on for each product barcode. Ultimately, I want each barcode to only have 1 line with all tests listed. The report would end up looking like this:

Barcode      Test1      Test2      Test3
Barcode1   Result2    Result4   Result5
Barcode2...
with only the most recent test result for each test showing, listed horizontally.

Not shown in the example is a testing date, and I've sorted in descending order so that the newest result is always listed first. I also currently have the report grouped by barcode which seems like a logical step. However, I'm not sure where to go from here. Any help or suggestions on how to approach this are appreciated!
IP IP Logged
Beaster
Newbie
Newbie


Joined: 23 May 2019
Online Status: Offline
Posts: 2
Quote Beaster Replybullet Posted: 03 Jun 2019 at 10:30am
I was able to solve this using subreports and shared variables.

1) Create 3 copies (1 for each test) of the main report to be used as subreports.
2) In the subreports, update the record selection formulas to select records based on test names.
3) Create shared variables for Test1, Test2, and Test3 results in their respective subreports and the main report.
4) Insert all the subreports into the details section of the main report. Subreports can be linked to main report using barcode field.
5) Place shared variables in the group footer. They should display the proper results.
6) Add barcode and other relevant database fields to group footer.

After tweaking settings related to exporting CSV files, results are as desired. If there's an easier/better way to do this, feel free to let me know.

Edited by Beaster - 03 Jun 2019 at 10:32am
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.031 seconds.