Transactions between table rows in the same or two different tables are also supported. As long the transaction operator has no assignment operator (described in the next sections further below), then the contents in the destination row will be cleared entirely before writing. Following rules apply:
Attention: In case no open-ended ranges have been specified, then only the columns with header names found in both source and destination tables will be transferred.
The following table applies to transactions between table rows (example: table names 't' and 'u', row 1 and 2, all columns) to a variable.
Transaction | Symbol | Explanation | Description |
---|---|---|---|
Copy | <== | [t:..,1] <== [u:,2] | Step 1: Checks that exactly one table row and one or more or all columns are specified. Step 2: Clears all contents in the specified table row Step 3: Data transfer from variable to table as described above. Note: The base variable will not be copied. |
Move | <<= | [t:..,1] <<= [u:,2]; | Steps 1-3: Like the copy-transaction Step 4: The specified row in the table will be deleted. The rows below will shift upwards. |
Swap | <=> | [t:..,1] <=> [u:,2]; | The contents in the member variable and the table row will be exchanged. |
table initialize( animals1,
{ { Name, Leg count, Special ability },
{ Owl, 2, Night vision },
{ Dog, 4, Sensitive nose },
{ Ape, 2 or 4, Relatively smart } } );
table initialize( animals2,
{ { Name, Leg count, Special ability, Weapon },
{ Bee, 6, Makes honey, sting },
{ Gnu, 4, Knows UNIX, horns },
{ Cat, 4, Empathy to humans, sharp claws } } );
[ animals1: Name, Dog, Name..Special ability ] <== [ animals2: Name, Cat, ]; // sharp claws will not be copied.
[ animals1: Name, Owl, .. ] <== [ animals2: Name, Bee, { Weapon, Name } ];
echo("Dog -> Cat without claws");
table list( animals1 ); // No additional column created
echo("Unchanged");
table list( animals2 ); // Additional column created
Dog -> Cat without claws
0 : Name | Leg count | Special ability | Weapon
1 : Bee | | | sting
2 : Cat | 4 | Empathy to humans |
3 : Ape | 2 or 4 | Relatively smart |
Unchanged
0 : Name | Leg count | Special ability | Weapon
1 : Bee | 6 | Makes honey | sting
2 : Gnu | 4 | Knows UNIX | horns
3 : Cat | 4 | Empathy to humans | sharp claws
table initialize( animals1,
{ { Name, Leg count, Special ability },
{ Owl, 2, Night vision },
{ Dog, 4, Sensitive nose },
{ Ape, 2 or 4, Relatively smart } } );
table initialize( animals2,
{ { Name, Leg count, Special ability, Weapon },
{ Bee, 6, Makes honey, sting },
{ Gnu, 4, Knows UNIX, horns },
{ Cat, 4, Empathy to humans, sharp claws } } );
[ animals2: Name, Gnu, .. ] <<= [ animals1: Name, Dog, ]; // Dog overwrites Gnu, Dog erased from animals 1
[ animals1: Name, Owl, ] <<= [ animals2: Name, Bee, .. ]; // Open ended items, also copy the weapon
echo("Contains the bee, owl and dog removed");
table list( animals1 ); // No additional column created
echo("Contains the dog, gnu and bee removed");
table list( animals2 ); // Additional column created
Contains the bee, owl and dog removed
0 : Name | Leg count | Special ability | Weapon
1 : Bee | 6 | Makes honey | sting
2 : Ape | 2 or 4 | Relatively smart |
Contains the dog, gnu and bee removed
0 : Name | Leg count | Special ability | Weapon
1 : Dog | 4 | Sensitive nose |
2 : Cat | 4 | Empathy to humans | sharp claws
table initialize( animals1,
{ { Name, Surface, Leg count, Special ability },
{ Owl, Feathers, 2, Night vision },
{ Dog, Fur, 4, Sensitive nose },
{ Ape, Hair, 2 or 4, Relatively smart } } );
table initialize( animals2,
{ { Name, Leg count, Special ability, Weapon },
{ Bee, 6, Makes honey, sting },
{ Gnu, 4, Knows UNIX, horns },
{ Cat, 4, Empathy to humans, sharp claws } } );
[ animals2: Name, Cat, .. ] <=> [ animals1: Name, Dog, ];
[ animals2: Name, Bee, Name..Special ability ] <=> [ animals1: Name, Owl, ]; // Excludes the weapon
echo("Contains Bee, Cat and Ape");
table list( animals1 ); // No additional column created
echo("Contains Owl, Gnu and Dog");
table list( animals2 ); // Additional column created
Contains Bee, Cat and Ape
0 : Name | Surface | Leg count | Special ability | Weapon
1 : Bee | | 6 | Makes honey |
2 : Cat | | 4 | Empathy to humans | sharp claws
3 : Ape | Hair | 2 or 4 | Relatively smart |
Contains Owl, Gnu and Dog
0 : Name | Leg count | Special ability | Weapon | Surface
1 : Owl | 2 | Night vision | |
2 : Gnu | 4 | Knows UNIX | horns |
3 : Dog | 4 | Sensitive nose | | Fur