Manipulating Data on a Grid: Scroll PeopleCode
2008-08-08 17:21
155 查看
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...
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...
相关文章推荐
- VB .NET 2003 using datagridTableStyles on multiple tables in a data grid
- VB .NET 2003 using datagridTableStyles on multiple tables in a data grid
- data.setFilter('people',"pm_project_riskmanage.fNoticeNameCode like '%"+personid+"%'");
- *****How to scroll in the grid when editing data in a cell
- Peoplecode to Create BI publisher XML and XSD Data source file.
- How to hide & unhide the grid from the page by using people code?
- [分治最短路 && 树链剖分]Codechef September Challenge 2017 QGRID. Querying on a Grid
- GridPanel OnRefreshData PagingToolBar 不调用刷新方法的解决方法
- Check for Data Duplicates on a Grid
- How to get the data from a cell when I click on the GridButtonColumn of the same row
- Hide a Grid Column From a Grid in PeopleCode
- If the root.sh script fails on a node during the install of the Grid Infrastructure with Oracle Data
- Smart grid could contribute to renewable energy use in data centers
- [ACM] POJ 1942 Paths on a Grid (组合)
- [INS-40406] The installer detects no existing Oracle Grid Infrastructure software on the system.
- Project Hosting on Google Code 为开放源代码项目提供了自由的协作开发环境。
- Paths on a Grid
- 【原创】Mr. Jack Online on Google Code
- Spatial data in sql and draw boundary on bing maps
- Code First for Mysql 错误:未为提供程序“MySql.Data.MySqlClient”找到任何 MigrationSqlGenerator