Monday, May 10, 2010

Effective Date Logic in PeopleSoft

I am sure people accessing this page are aware of the Effective date Logic in PeopleSoft. But interestingly i found a different Behavior of Effective Date.

Lets take an Example of record having Effective Date in it.

Record name:- PS_EFFDT_TST
Record Structure:- (K)- Key
EMPLID (K)
EMPL_RCD (K)
EFFDT (K)

The Query to Select Data from this table with Effective Date condition will be

SELECT A.EMPLID, A.EMPL_RCD FROM PS_EFFDT_TST A
WHERE A.EFFDT =
(SELECT MAX(B.EFFDT)
FROM PS_EFFDT_TST B
WHERE B.EMPLID = A.EMPLID
AND B.EMPL_RCD = A.EMPL_RCD
AND B.EFFDT <= SYSDATE ) Also if we use %EffDtCheck function to write this query we will have SELECT A.EMPLID, A.EMPL_RCD FROM %Table(EFFDT_TST) A WHERE %EffDtCheck(EFFDT_TST B, A, %CurrentDateIn) There is no Problem so far. Now lets modify the Record Structure little more with one more Key field after Effdt field. Record name:- PS_EFFDT_TST
Record Structure:- (K)- Key
EMPLID (K)
EMPL_RCD (K)
EFFDT (K)
RUN_ID (K)

The Query to Select Data from this table with Effective Date condition will be

SELECT A.EMPLID, A.EMPL_RCD
FROM PS_EFFDT_TST A
WHERE A.EFFDT =
(SELECT MAX(B.EFFDT)
FROM PS_EFFDT_TST B
WHERE B.EMPLID = A.EMPLID
AND B.EMPL_RCD = A.EMPL_RCD
AND B.EFFDT <= SYSDATE ) But if we use %EffDtCheck condition in this table SELECT A.EMPLID, A.EMPL_RCD FROM %Table(EFFDT_TST) A WHERE %EffDtCheck(EFFDT_TST B, A, %CurrentDateIn) we get following query after Resolve SELECT A.EMPLID, A.EMPL_RCD FROM PS_EFFDT_TST A WHERE A.EFFDT = (SELECT MAX(B.EFFDT) FROM PS_EFFDT_TST B WHERE B.EMPLID = A.EMPLID AND B.EMPL_RCD = A.EMPL_RCD
AND B.RUN_ID = A.RUN_ID

AND B.EFFDT <= SYSDATE
)

which i feel is wrong.

No comments:

Post a Comment