Tuesday, April 6, 2010

How to disable rows in a scroll level based on a field value

In this example i need to disable the rows in the job component based on action reason field value for certain users.
The below code is written at the component level. If you have more than one level you can expand the below code to disable the fields for level 2 and level 3.


Local Rowset &MYROWSET;

If IsUserInRole("DEPT_TIMEKEEPER", "DEPT_PR_PRSR") Then
&MYROWSET = GetRowset();
For &A = 1 To &MYROWSET.ActiveRowCount;
&LEVEL1_ROW = &MYROWSET(&A);
&Action_Reason = &LEVEL1_ROW.GetRecord(Record.JOB).ACTION_REASON.VALUE;
If &Action_Reason = "WLT" Then
For &R = 1 To &LEVEL1_ROW.RECORDCOUNT
&Rec = &LEVEL1_ROW.GetRecord(&R);
For &J = 1 To &Rec.FieldCount
&Fld = &Rec.GetField(&J);
&Fld.Enabled = False;
End-For;
End-For;
End-If;
End-For;
End-If;

No comments:

Post a Comment