table initialize

Prev Next

Function Names

table initialize

Description

This function creates resp. initializes tables and puts the contents provided in the further function parameters into the table.

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
set Initial contents

Applicable except for table append on same field:
If multiple values (of any valid type) are put into a simple 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 sets, e.g. ({ Name, Score }, { Alex, 12 }, { Lina, 14 }}, then the items in the nested 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 } } );

               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

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

See also

table create
table append blank rows
table add row