Here is a handy CI Method for the Job Data component that will set the Effective Sequence for a newly entered Job Data row.
CI Method code:
Function setEffSeq
Local Rowset &job;
&job = GetRowset(Scroll.JOB);
If &job(1).JOB.EFFDT.Value = &job(2).JOB.EFFDT.Value Then
&job(1).JOB.EFFSEQ.Value = &job(2).JOB.EFFSEQ.Value + 1;
End-If;
End-Function;
|
Screen Shot of Method in CI
|
This method is used after adding a new job row via the CI and then call this method to set the next effective sequence number.
Sample CI Code:
&oSession = %Session;
&oSession.PSMessagesMode = 1;
&oZzCiJobData = &oSession.GetCompIntfc(CompIntfc.ZZ_CI_JOB_DATA);
&oZzCiJobData.InteractiveMode = False;
&oZzCiJobData.GetHistoryItems = True;
&oZzCiJobData.EditHistoryItems = False;
&oZzCiJobData.GET_EMPLID = [*];
&oZzCiJobData.GET_EMPL_RCD = [*];
rem ***** Execute Get *****;
If Not &oZzCiJobData.Get() Then
rem ***** No rows exist for the specified keys.*****;
errorHandler();
throw CreateException(0, 0, "Get failed");
End-If;
&oJobCollection = &oZzCiJobData.JOB;
&oJob = &oJobCollection.InsertItem(1);
&oJob.EFFDT = %DATE;
&oJob.action = "DTA";
&oZzCiJobData.setEffSeq();
Even Better, use it in CI Template
|
A Better Way to Code with CIs |
Security
|
Don't forget to Grant Security to your Method! |
No comments:
Post a Comment