Skip to main content
Version: 20 R6 BETA

VP INSERT TABLE ROWS

History
ReleaseChanges
19 R7Added

VP INSERT TABLE ROWS ( vpAreaName : Text ; tableName : Text ; row : Integer {; count : Integer {; insertAfter : Integer {; sheet : Integer }}} )

ParameterTypeDescription
vpAreaNameText->4D View Pro area form object name
tableNameText->Table name
rowInteger->Index in the table of the starting row to insert
countText->Number of rows to add (must be >0)
insertAfterInteger->vk table insert before or vk table insert after row
sheetInteger->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:

ConstantValueDescription
vk table insert before0Insert row(s) before the row (default if omitted)
vk table insert after1Insert 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)

See also

VP INSERT TABLE COLUMNS
VP REMOVE TABLE ROWS