Skip to main content
Version: Next

WP TABLE DELETE ROWS

WP TABLE DELETE ROWS ( targetObj ) | ( tableRef ; rowNumber {; numRows} )

ParameterTypeDescription
targetObjObjectRange or element or 4D Write Pro document
tableRefObjectTable reference
rowNumberIntegerRow index number
numRowsIntegerNumber of rows to delete (default value = 1)

Description

The WP TABLE DELETE ROWS command removes one or several row(s) from a 4D Write Pro table.

This command supports two syntaxes:

  • If you pass a targetObj as the first parameter, the command will remove all the rows in table(s) intersecting the target. targetObj can contain:
    • a range, or
    • an element (row / paragraph / body / header / footer / inline picture / section / subsection), or
    • a 4D Write Pro document.
    If targetObj intersects with several tables, touched rows in all tables are removed. If targetObj does not intersect with a table, the command does nothing (no error is generated).
    With this syntax, the numRows parameter (if passed) is ignored.
  • If you pass both a tableRef and a rowNumber, the command will remove the row(s) in the designated table, starting at the specified row index number.
    With this syntax, the optional numRows parameter defines the number of rows to remove from tableRef. By default, if this parameter is omitted, one row is removed.

Removing all rows of a table will remove the entire table.

Example

You want to delete two rows from the Invoice table. This code:

 var $table : Object
 
 $table:=WP Get element by ID(WParea;"Invoice") //retrieve "Invoice" table
 
 WP TABLE DELETE ROWS($table;3;2) //remove 2 rows after 2nd row (3rd position)

Will remove the two rows from the correct location:

See also

WP TABLE DELETE COLUMNS