VP INSERT TABLE ROWS
History
Release | Changes |
---|---|
19 R7 | Added |
VP INSERT TABLE ROWS ( vpAreaName : Text ; tableName : Text ; row : Integer {; count : Integer {; insertAfter : Integer {; sheet : Integer }}} )
Parameter | Type | Description | |
---|---|---|---|
vpAreaName | Text | -> | 4D View Pro area form object name |
tableName | Text | -> | Table name |
row | Integer | -> | Index in the table of the starting row to insert |
count | Text | -> | Number of rows to add (must be >0) |
insertAfter | Integer | -> | vk table insert before or vk table insert after row |
sheet | Integer | -> | Sheet index (current sheet if omitted) |
Description
The VP INSERT TABLE ROWS
command inserts one or count empty row(s) in the specified tableName at the specified row index.
In the insertAfter parameter, you can pass one of the following constants to indicate if the row(s) must be inserted before or after the row index:
Constant | Value | Description |
---|---|---|
vk table insert before | 0 | Insert row(s) before the row (default if omitted) |
vk table insert after | 1 | Insert row(s) after the row |
This command inserts some rows in the tableName table, NOT in the sheet. The total number of rows of the sheet is not impacted by the command. Data present below the table (if any) are automatically moved down according to the number of added rows.
If the tableName table is bound to a data context, the command inserts new, empty element(s) in the collection.
If tableName does not exist or if there is not enough space in the sheet, nothing happens.
Example
You create a table with a data context:
var $context : Object
$context:=New object()
$context.col:=New collection
$context.col.push(New object("name"; "Smith"; "salary"; 10000))
$context.col.push(New object("name"; "Wesson"; "salary"; 50000))
$context.col.push(New object("name"; "Gross"; "salary"; 10500))
VP SET DATA CONTEXT("ViewProArea"; $context)
VP CREATE TABLE(VP Cells("ViewProArea"; 1; 1; 3; 3); "PeopleTable"; "col")
You want to insert two rows and two columns in the table, you can write:
VP INSERT TABLE ROWS("ViewProArea"; "PeopleTable"; 1; 2)
VP INSERT TABLE COLUMNS("ViewProArea"; "PeopleTable"; 1; 2)