table append ...

Prev Next

Function Names

table append, table append on same row, table append on same field

Description

table append assumes tables already existing. Contents are addeded on the next row.
table append on same row assumes tables already existing. Contents are addeded on the next column at the last row.
table append on same field assumes tables already existing and expects a string in the 2nd function parameter. This string will be appended to the last existing field at the right in the last table row.

Call as: procedure or function

Restrictions

Indirect parameter passing is disabled

Parameter count

2

Parameters

No.TypeDescription
1
input
string name of new or existing table

Table must be existing when using table append... functions. Otherwise, it does not matter.

2
input
parameter set Initial contents

Applicable except for table append on same field:
If multiple values (of any valid type) are put into a simple parameter set, e.g. { A text, 123, true, Another text }, then every value will be added in separate rows, column 0.

If value are put into nested parameter sets, e.g. ({ Name, Score }, { Alex, 12 }, { Lina, 14 }}, then the items in the nested parameter sets will be written in different columns in the same row.

Alt. 2
input
string Initial contents

Applicable for table append on same field only:
One string which will be appended to the existing contents (without any separator characters between) in the last existing column at the right on the last row.

Return value

TypeDescription
boolean Feedback

true if successful. false is returned in case of memory allocation exceptions (very rare cases, if at all).

Examples

      include ( Support Library ); // for 'table list'. Will be included automatically when using B4P normally, i.e. not needed.
      table initialize( t1,
      { { Name, Street, Nr }, { Alex,Main St., 231 },Tom,Jerry,{ Tillman,South St., 1 }, { Jane,East Coast St.,3200 East Entrance } } );
      // Notice: Tom and Jerry get their own rows for their cat and mouse play

      table append             ( t1, { { Corinne, River Side Blvd., 987 } } );
      table append on same row ( t1, { { Runs a Café, "Tel: +1 202 555 1212" } } ); // Takes additional columns

      table append               ( t1, { { Matteo, Springs Lane, 964 } } );
      table append on same field ( t1, " Suite 3" );

      table list( t1 );

Output

    0 : Name    | Street           | Nr                 |             |                     
    1 : Alex    | Main St.         | 231                |             |                     
    2 : Tom     |                  |                    |             |                     
    3 : Jerry   |                  |                    |             |                     
    4 : Tillman | South St.        | 1                  |             |                     
    5 : Jane    | East Coast St.   | 3200 East Entrance |             |                     
    6 : Corinne | River Side Blvd. | 987                | Runs a Café | Tel: +1 202 555 1212
    7 : Matteo  | Springs Lane     | 964 Suite 3        |             |                     

Try it yourself: Open LIB_Function_table_append.b4p in B4P_Examples.zip. Decompress before use.

See also

table create
table append blank rows
table add row