Joined: 27 Apr 2012
Location: United States
Online Status: Offline
Posts: 140
Topic: Compare Data in 2 different rows Posted: 19 Dec 2013 at 3:07am
I'm using Crystal 2008. The goal of the report is to display records for both Federal and State W4 exemptions IF one of the two deductions (or both)have been modified within the last 7 days. If both deduction were modified later than 7 days, then exclude. This is my first challenge. My second step is to display only records where the State exemption is less than the Fed. I think I can figure that out. My raw data looks like this (I've added the last 2 columns to illustrate the records I'll need to capture:
Employee
Deduction Code
Date Stamp
Scenario
Result
1234
9FDW
9/1/2012
1
Display on the report
1235
9MNW
12/19/2013
1
Display on the report
5555
9FDW
12/19/2013
2
Display on the report
5555
9MNW
12/19/2013
2
Display on the report
4444
9FDW
9/1/2012
3
Do not Display
4444
9MNW
9/1/2012
3
Do No Display
Once I've captured the first 2 scenarios, then I will move to grouping by Employee and doing running totals to align the Exemptions (not shown) so they can be compared.
"Press any key to continue. Where's the 'Any' Key?" ~Homer Simpson
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Posted: 19 Dec 2013 at 4:56am
I would think that a stored procedure would be 'easier' but barring that, I think what I would try is something along the lines of this:
in the main report I would generate a list of employees or some identifier for all the records that have been modified in the last 7 days. I would stored these values in a shared array variable.
Then I would have a subreport, that would be the 'actual' report and I would pass the shared array variable and filter those records to be both records assigned to the value in the array...
I would write the stored proc to do a similar process...fist find records that were modified in the time period and then return all records associated with the changed records, and then display them.
Hopefully, this makes sense as a strategy to get the report up and running.
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