You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

Populate Multiple Grids on a same Page with diff output based on conditions.

No replies
Guest's picture

Hi To Populate Multiple Grids from one main record
Two Grids are on a same page with a same main record and different page field name.
I would like to populate two grids independently from one record based on conditions, but not sure on how we can distinguish between grid names.
I under GetGrid, but how we can write under IF condition.
The outcome of below code is it's populating both grids based on the last rowset result and not by specific Grid

Below is my code under field Change.

Local Rowset &Level0wk, &Level0wk1, &firstGrid_RS, &SecondGrid_RS;
Local Grid &getfirstGrid, &getscndGrid;
Local string &sWhere;

/*&getGrade = IP_PROMOTIONS.IP_GRADE.Value;
&getMonth = IP_PROMOTIONS.MONTHCD.Value;*/

&Level0wk = GetLevel0();
&Level0wk1 = GetLevel0();
&getfirstGrid = GetGrid(Page.IP_DEPTSTG_DTALOAD, "IP_PROMO_FE");
&getscndGrid = GetGrid(Page.IP_DEPTSTG_DTALOAD, "IP_PROMO_FE1");

rem MessageBox(0, "", 0, 0, "ActiveRowCount->" | &getfirstGrid);

MessageBox(0, "", 0, 0, "First Grid" | &getfirstGrid);
MessageBox(0, "", 0, 0, " Second Grid" | &getscndGrid);

If &getProType = "D" Then


If All(&getfirstGrid) Then

&firstGrid_RS = &Level0wk(1).GetRowset(Scroll.IP_PROMOTIONS);
&firstGrid_RS.Select(Record.IP_PROMOTIONS, "WHERE IP_PROMOTION_TYPE = :1", &getProType);

If All(&getscndGrid) Then

&SecondGrid_RS = &Level0wk1(1).GetRowset(Scroll.IP_PROMOTIONS);
&SecondGrid_RS.Select(Record.IP_PROMOTIONS, "WHERE IP_PROMOTION_TYPE = :1 AND IP_ELIGIBILITY = 'E'", &getProType);