This is the opposite direction where member contents of structures or arrays are transferred into tables. In contrast to transaction to tables
without assignment operators, the data in the destination table row will not be deleted. Only the specifed data columns will be overwritten as long as
matching data from the source variable is available. No additional table columns are introduced here to insert the remaining data.
Destination table rules: See section on Transactions from Variables to Tables.
The only exception is that destination table rows are not cleared, and the open-ended ranges rule does not apply for the & assignment operator.
The ^ suffix, if used, does not affect the functionality with copy- and swap-transactions because the destination is a table and table names will not be changed during transactions.
Structures to tables:
The member names will be matched with the existing column header names, provided they are part of the table specification
(where whole row, a set of columns, a range or just one column is defined). If a member name cannot be matched with any column header, then it will be ignored.
Arrays to tables:
The array members will be written into the table fields as defined in the table specification (whole row, set of columns, a range or just one column).
Normally, the members are written to the table from left to right except if a set of columns is specified. In this case, the sequence inside the set will apply.
If the array contains more elements than the number of columns (header names) provided, then the remaining elements will not be written into the table.
table initialize( animals,
{ { Name, Leg count, Special ability },
{ Owl, 2, Night vision },
{ Dog, 4, Sensitive nose },
{ Ape, 2 or 4, Relatively smart } } );
structure( animal1[], { Name, Special ability, Skin surface, Strange habit },
{ Bat, "On-flight acoustic radar", skin wings, hangs while sleeping } );
array( animal2[], { Crab, 10, walks sideways, some are delicious } );
[ animals: .., 2 ] &<== animal1[];
[ animals: .., 3 ] &<<=^ animal2[]; // If ^-symbol is not used, then animal2[] would be deleted.
see( animal1[] );
see( animal2[] );
table list( animals ); // Contains owl, bat and crab
animal1[] [Void] (void,full access)
Name Bat (softquoted string,full access)
Skin surface skin wings (softquoted string,full access)
Special ability On-flight acoustic radar (quoted string,full access)
Strange habit hangs while sleeping (softquoted string,full access)
animal2[] [Void] (void,full access)
0 : Name | Leg count | Special ability
1 : Owl | 2 | Night vision
2 : Bat | 4 | On-flight acoustic radar
3 : Crab | 10 | walks sideways
table initialize( animals,
{ { Name, Leg count, Special ability },
{ Owl, 2, Night vision },
{ Dog, 4, Sensitive nose },
{ Ape, 2 or 4, Relatively smart } } );
structure( animal1[], { Name, Special ability, Skin surface, Strange habit },
{ Bat, "On-flight acoustic radar", skin wings, hangs while sleeping } );
array( animal2[], { Crab, 10, walks sideways, some are delicious } );
[ animals: .., 2 ] &<=> animal1[]; // Swap, with table name in base variable
[ animals: .., 3 ] &<=>^ animal2[]; // Swap
see( animal1[] ); // Strange animal descriptions ...
see( animal2[] );
table list( animals ); // Contains owl, bat and crab with some info
animal1[] animals (quoted string,full access)
Name Dog (quoted string,full access)
Skin surface skin wings (softquoted string,full access)
Special ability Sensitive nose (quoted string,full access)
Strange habit hangs while sleeping (softquoted string,full access)
animal2[] [Void] (void,full access)
Array [ 0] Ape (quoted string,full access)
Array [ 1] 2 or 4 (quoted string,full access)
Array [ 2] Relatively smart (quoted string,full access)
Array [ 3] some are delicious (softquoted string,full access)
0 : Name | Leg count | Special ability
1 : Owl | 2 | Night vision
2 : Bat | 4 | On-flight acoustic radar
3 : Crab | 10 | walks sideways