When you have a grid that is filled with data; data that you don't want. How do you clear it out and then fill it with the data set that you do want? Well, here are the simple steps to do just that.
Lets say we have a Grid on a page and the main record on the grid is called COMPETENCIES. Well we would first want to define a Rowset object to manipulate. The code for this would look as follows:
Local Rowset &COMPETENCIES;
Next we will want to instantiate the object. Instantiate just means to represent by an instance. If you notice, I am not creating a new Rowset. I am getting the Rowset from the current grid called competencies, using the GetRowSet function. And, I am defining the Grid object as a Rowset.
&COMPETENCIES = &REVIEW(CurrentRowNumber(1)).GetRowset(Scroll.COMPETENCIES);
Once that is complete, I want to remove all rows of data from the Grid. To do that I simply use the
Flush method.
&COMPETENCIES.Flush();
Now lets fill the grid with new data that we really want.
&COMPETENCIES.Select(Record.COMPETENCIES,"WHERE EMPLID = :1 AND EVALUATION_ID = :2 AND COMPETENCY IN " | &IN | " AND EFFDT = %DATEIN(:3)", &EMPLID, &EVALUATION_ID, &REVIEW_DT);
What I am doing in the above line of code is selecting the data that I want to use to fill the grid. By selecting the record I am in essence asking to select all the fields that are on the grid from the COMPETENCIES table with the where clause.
Thats it! It's that simple.
If you want to learn more about Object Scroll PeopleCode, check out the book called
"A Guide to Programming Object Scroll PeopleCode."
Happy Coding...
转载于:https://www.cnblogs.com/GoDevil/archive/2008/08/08/1263904.html
本文介绍了一种在网格中清除不想要的数据并填充所需数据集的简单步骤。首先定义一个Rowset对象,然后实例化该对象以从当前网格获取数据。接着使用Flush方法清除所有数据行,最后选择特定条件下的数据填充网格。
1393

被折叠的 条评论
为什么被折叠?



