This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20
WP Table append row

WP Table append row 


 

WP Table append row ( tableRef ; value {; value2 ; ... ; valueN} ) -> Function result 
Parameter Type   Description
tableRef  Object in Table reference
value  Text, Number, Time, Date, Picture in Value(s) to set in the row
Function result  Object in 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:

  • text: left aligned
  • pictures: centered
  • other type (numbers, date, and time): right aligned

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)



See also 

WP Insert table
WP Table get rows

 
PROPERTIES 

Product: 4D
Theme: 4D Write Pro Language
Number: 1474

This command can be run in preemptive processes

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D v16 R4

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v20)