Traversing Level 0 to Level 3 By PeopleCode
Example code about Traversing Level 0 to Level 3 By PeopleCode. You can copy and paste this code of each event action and change record name and scroll name and filed name.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
Local Rowset &rsLevel0, &rsLevel1, &rsLevel2, &rsLevel3; Local Row &rowLevel0, &rowLevel1, &rowLevel2, &rowLevel3; Local Field &fldLevel0, &fldLevel1, &fldLevel2, &fldLevel3; Local integer &i, &j, &k; &rsLevel0 = GetLevel0(); /** Get Level 0 Field **/ &fldLevel0 = &rsLevel0.GetRow(1).GetRecord(Record.L0_REC).GetField(Field.L0_FLD); /** Get Level 0 Field Value **/ &Level0FldValue = &fldLevel0.Value; &rowLevel0 = &rsLevel0.GetRow(1); &rsLevel1 = &rowLevel0.GetRowset(Scroll.LEVEL1_RECORD); For &i = 1 To &rsLevel1.ActiveRowCount /** Get Level 1 Field **/ &fldLevel1 = &rsLevel1.GetRow(&i).GetRecord(Record.L1_REC).GetField(Field.L1_FLD); /** Get Level 1 Field Value **/ &Level1FldValue = &fldLevel1.Value; &rowLevel1 = &rsLevel1.GetRow(&i); &rsLevel2 = &rowLevel1.GetRowset(Scroll.LEVEL2_RECORD); For &j = 1 To &rsLevel2.ActiveRowCount /** Get Level 2 Field **/ &fldLevel2 = &rsLevel2.GetRow(&j).GetRecord(Record.L2_REC).GetField(Field.L2_FLD); /** Get Level 2 Field Value **/ &Level2FldValue = &fldLevel2.Value; &rowLevel2 = &rsLevel2.GetRow(&j); &rsLevel3 = &rowLevel2.GetRowset(Scroll.LEVEL3_RECORD); For &k = 1 To &rs_level3.ActiveRowCount /** Get Level 3 Field **/ &fldLevel3 = &rsLevel3.GetRow(&k).GetRecord(Record.L3_REC).GetField(Field.L3_FLD); /** Get Level 3 Field Value **/ &Level3FldValue = &fldLevel3.Value; &rowLevel3 = &rsLevel3.GetRow(&k); /* Do Processing **/ /* If Any Summation Calculation */ /* &sum = &sum + &Level3FldValue */ End-For; End-For; End-For; |
Reference : http://www.dbtutor.com/2013/06/02/peoplecode-for-traversing-level-0-to-level-3