Monday, May 24, 2010

Row Traversing

&LEVEL0 = GetLevel0();                                               --level zero rowset
&LEVEL0_ROW = &LEVEL0(1);                                            --Level Zero Row
&LEVEL1 = &LEVEL0_ROW.GetRowset(SCROLL.EMPL_CHECKLIST);              --level1 Rowset


For &I = 1 to &LEVEL1.ActiveRowCount --for loop to get all the values till current row
   &LEVEL1_ROW = &LEVEL1(&I);
   &LEVEL2 = &LEVEL1_ROW.GetRowset(SCROLL.EMPL_CHKLST_ITM);
   For &J = 1 to &LEVEL2.ActiveRowCount
        &LEVEL2_ROW = &LEVEL2(&J);
        &LEVEL3 = &LEVEL2_ROW.GetRowset(SCROLL.EMPL_CHKLST_ITM_1);
        For &k = 1 to &LEVEL3.ActiveRowCount
                &LEVEL3_ROW = &LEVEL3(&k);
               &RECORD = &LEVEL3_ROW.EMPL_CHKLST_ITM_1;              --get record
               &Emplid = &RECORD.emplid.value;                       --get value
               Winmessage(“Employee ID: “|&Emplid);                  --to display all retrieved employee IDs online
        End-For;
   End-For;
End-For;

In this case for suppose we have 1 row in EMPL_CHECKLIST, 5 rows in EMPL_CHKLST_ITM, 10 rows in EMPL_CHKLST_ITM_1 for the same employee ID, then we will get 10 messages when the system executes given code.


Some more Row Traversing functions:

CurrentRowNumber(1);

2 comments: