Record Change PeopleCode
How to check record change PeopleCode in peoplesoft. I have the example about checking record in saveprechange event, field change event or save edit of PeopleCode. Define page has scroll area in level 1 and the user can edit the value of each field. When the user changes data and saves data then system update date time and operator id.
Example 1
1 2 3 4 5 6 7 8 9 10 11 12 13 |
Local Rowset &rsLevel0, &rsLevel1; Local Row &rowLevel0, &rowLevel1; &rsLevel0 = GetLevel0(); &index = CurrentRowNumber(); rem WinMessage(&index, 0); &rowLevel0 = &rsLevel0.GetRow(1); &rsLevel1 = &rowLevel0.GetRowset(Scroll.ScrollName); &rowLevel1 = &rsLevel1.GetRow(&index); If &rowLevel1.IsChanged Then TABLE.Date.Value = %Datetime; TABLE.EMPLID.Value = %OperatorId; End-If; |
Example 2: Check record change from some field in page in scroll area level 1. This code using for loop all record in level one. If record changed then update filed last_emplid and LAST_UPDATE_DTTM1. I replace code at SavePreChange action of record contracts (saveedit, savepostchange,etc).
1 2 3 4 5 6 7 8 9 |
&Level0_ROWSET = GetLevel0(); For &I = 1 To &Level0_ROWSET.ActiveRowCount If RecordChanged(Record.CONTRACTS, CurrentRowNumber(1)) Then rem WinMessage("Changed row message from level one.", 64); CONTRACTS.LAST_EMPLID.Value = %OperatorId; CONTRACTS.LAST_UPDATE_DTTM1.Value = %Datetime; End-If; End-For; |
Exmaple 3: The code would execute on level one, checks rows on level two to determine which have been changed
1 2 3 4 5 |
For &I = 1 To ActiveRowCount(RECORD.BUS_EXPENSE_PER, CurrentRowNumber(1), RECORD.BUS_EXPENSE_DTL); If RecordChanged(RECORD.BUS_EXPENSE_PER, CurrentRowNumber(1), RECORD.BUS_EXPENSE_DTL, &I) Then WinMessage("Changed row message from level one.", 64); End-If; End-For; |
Reference: https://docs.oracle.com/cd/E13292_01/pt849pbr0/eng/psbooks/tpcl/chapter.htm?File=tpcl/htm/tpcl02.htm