Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate Records 1

Status
Not open for further replies.

christimess

Programmer
May 26, 2004
33
US
I have created a form report and need to pull in the last 5 history rows from the JOB table. Since a form report only shows one row of data I added the JOB table into the report 5 times, one for each history row. I have the Reports Effective Date set to None.
I am trying to translate the Reason Code. So I figured that I would need to add the ACTN_REASON_TBL 5 times, one for each JOB table and because the JOB table is set to None I would need to create a selection criteria selection criteria to get the lastest information from the ACTN_REASON_TBL. (SELECT MAX(ACTION2.EFFDT) FROM DEMO.PS_ACTN_REASON_TBL ACTION2 WHERE PS_ACTN_REASON_TBL = ACTION2.EFFDT) Unfortunatly I am still getting multiple pages due to the multiple rows on the Action Reason table. Does anyone have any suggestions? Thanks!!!!
 
Here's the solution:

Add the JOB table, but set the Effective Date Logic of the Report to "As of current date". Then go into Selection Criteria and delete the line that sets the EFFDT of the JOB table to be the current date. This is a good way to show history from a table without setting the effective date logic of the whole report to "None" Then when you add the ACTN_REASON_TBL, it will automatically pull the most current description for the reason code.

By the way, if you were hard coding the logic yourself:

ACTION.EFFDT =
(
SELECT MAX(ACTION2.EFFDT)
FROM PS_ACTN_REASON_TBL ACTION2
WHERE ACTION.ACTION = ACTION2.ACTION AND
ACTION.ACTION_REASON = ACTION2.ACTION_REASON AND
EFFDT <= GETDATE()
)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top