Saturday 27 February 2021

3D Array in Peoplecode

 

Local array of array of array of string &ISTArray = CreateArrayRept(CreateArrayRept(CreateArrayRept("", 0), 0), 0);


Local number &n_element;

Local string &type = "IST";

&REC = CreateRecord(Record.L_MJR_DATA_TEMP);

&n_element = 1;

&n_element1 = 1;

For &r = 1 To &rs.ActiveRowCount

   /*Get grid row*/

   &row1 = &rs.GetRow(&r);

   /* IST Inter School Transfer Grid Count */

   

   If ( Not None(&row1.L_ADD_MAJOR_2.ACAD_PLAN.Value)) Or

         ( Not None(&row1.L_ADD_MAJOR_2.ACAD_GROUP.Value)) Then

      

      

      

      &ISTArray.Push(&type);

      &ISTArray [&n_element].Push(&row1.L_ADD_MAJOR_2.ACAD_GROUP.Value, &row1.L_ADD_MAJOR_2.ACAD_PLAN.Value);

      

      &n_element1 = &n_element1 + 1;

      

      

      

      &SQL = CreateSQL(SQL.L_GET_ISTGRID_SQL, &row1.L_ADD_MAJOR_2.ACAD_GROUP.Value, &lvl, "IST");

      

      While &SQL.Fetch(&group, &max, &min)

         

         

         &ISTArray.Push(&group);

         &ISTArray [&n_element].Push(&max, &min);

         

         &n_element = &n_element + 1;

         

      End-While;

   End-If;

End-For;


REM &CONT =0;

For &i = 1 To &ISTArray.Len

   

   &GroupVal = &ISTArray [&i][1][1];

   

   &MaxVal = &ISTArray [&i][2][1];

   

   &MinVal = &ISTArray [&i][3][1];

   

     

   REM  MessageBox(0, "", 0, 0, "values are " | &GroupVal | "--" | &MaxVal | "--" | &MinVal | "--" | &ISTArray.Len);

   

End-For;