This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20
WP Table append row
|
WP Table append row ( tableRef ; value {; value2 ; ... ; valueN} ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
tableRef | Object |
![]() |
Table reference | |||||
value | Text, Number, Time, Date, Picture |
![]() |
Value(s) to set in the row | |||||
Function result | Object |
![]() |
Row range object | |||||
The WP Table append row command appends one row to the tableRef table, fills it with value(s) and returns the corresponding row range object.
The command adds as many cells in the row as there are values in the value parameter. You can pass any number of values of different types; the default cell alignment will depend on the value type:
Note: Array type values are not supported.
The command returns the new row as a row range object.
You want to create an empty table and append several rows of different sizes. You can write:
C_OBJECT($wpTable;$wpRange;$wpRow1;$wpRow2;$wpRow3)
$wpRange:=WP Text range(WParea;wk start text;wk end text)
$wpTable:=WP Insert table($wpRange;wk append)
$wpRow1:=WP Table append row($wpTable;"Paul";"Smith";25)
$wpRow2:=WP Table append row($wpTable;"John";"Richmond";40)
$wpRow3:=WP Table append row($wpTable;"Mary";"Trenton";18;"New!")
In a billing application, you want to create a table automatically filled with related invoice lines:
C_OBJECT($wpTable;$wpRange)
$wpRange:=WP Text range(4DWPArea;wk start text;wk end text)
$wpTable:=WP Insert table($wpRange;wk append) //create the table
// add the header row
$row:=WP Table append row($wpTable;"Name";"Quantity";"Unit Price";"Discount Rate";"Total")
WP SET ATTRIBUTES($row;wk font bold;wk true;wk text align;wk center)
//simply apply to selection
APPLY TO SELECTION([INVOICE_LINES];WP Table append row($wpTable;[INVOICE_LINES]ProductName;[INVOICE_LINES]Quantity;[INVOICE_LINES]ProductUnitPrice;[INVOICE_LINES]DiscountRate;[INVOICE_LINES]Total))
//add a footer row
$row:=WP Table append row($wpTable;"Total:";Sum([INVOICE_LINES]Quantity);"";"";Sum([INVOICE_LINES]Total))
//format the table
$range:=WP Table get columns($wpTable;1;5)
WP SET ATTRIBUTES($range;wk width;"80pt")
WP SET ATTRIBUTES($wpTable;wk font size;10)
Product: 4D
Theme: 4D Write Pro Language
Number:
1474
Created: 4D v16 R4
4D Write Pro Reference ( 4D v20)