Friday, October 30, 2009

Populate Data on a button click


The code below will show you how to populate data to a grid using the parameters entered in the same page. Initially the grid will be invisible. That is the best practice.

Global any &count;

Local Rowset &rs0, &rs1;

Local Row &row0, &row1;

Local any &I = 1;

&count = 0;

rem HideScroll(Record.Record Name);

If &count > 0 Then

   UnhideScroll(Record.Record Name);

   &rs0 = GetLevel0();

   &row0 = &rs0(1);

   &rs1 = &row0.GetRowset(Scroll.Record Name);

   &rs1.Flush();

   &SQL1 = CreateSQL("                        );

   While &SQL1.Fetch(   &ex1,&ex2)                             )

      &rs1.InsertRow(&I);

      &row1 = &rs1(&I);

      &row1.field1.Value &ex1;

      &row1.field2.Value = &ex2;

       &I = &I + 1;

      End-While;

   &rs1.DeleteRow(&I);

   Else

   WinMessage("There are no records  for this  search criteria", 0);

End-If;

Happy Learning !

0 comments:

Post a Comment

Total Pageviews

Copyright © Tech & Management Notes