Different from transactions without assignment operators, the & assignment operator in front of the transaction symbol will assume the following rules focussing on overlaying data from the source variable in the destination variable:
Following actions are applied on the destination variables using this assignment operator:
Destination | Source | Description |
---|---|---|
Simple or zero members | Simple or zero members | The value of the base variable will be transferred as long no ^ suffix is specified. |
Simple or zero members | Array | Base variable: See above. The array nembers are not transferred. Same applies to their sub-members. |
Simple or zero members | Structure | Base variable: See above. The structure nembers are not transferred. Same applies to their sub-members. |
Structure | Simple or zero members | Base variable: See above. |
Structure | Array | Base variable: See above. The array members are not copied into structure members as they are incompatiable (missing names). |
Structure | Structure | Base variable: See above. The members for which corresponding member positions are already existing in the destination variable will also be transferred. - Existing members will be overwritten - No additional member names will be added. |
Array | Simple or zero members | Base variable: See above. |
Array | Array | Base variable: See above. The members for which corresponding member positions are already existing in the destination variable will also be transferred. - If the destination has more members than the source, then the excess destination members remain unaffected. - If the destination has fewer members than the source, then the remaining members in the source variable will not be copied. |
Array | Structure | Base variable: See above. The members for which corresponding member positions are already existing in the destination variable will also be transferred. The existing array members will be replaced by structure members from the source variable, sorted in alphabetic order by member names. - If the destination has more members than the source, then the excess destination members remain unaffected. - If the destination has fewer members than the source, then the remaining members in the source variable will not be copied. |
structure( animals1[], { mammal, bird, fish }, { dog, owl, eel} );
structure( animals1[mammal], { carnivore, herbivore }, { bear, deer } );
structure( animals2[], { mammal, fish, reptile }, { cat, trout, turtle } );
structure( animals2[mammal], { carnivore, omnivores }, { lynx, skunk } );
animals1[] &<== animals2[]; // Trout and cat overwritten, owl survives
see(animals1[]);
animals1[] [Void] (void,full access)
bird owl (softquoted string,full access)
fish trout (softquoted string,full access)
mammal cat (softquoted string,full access)
carnivore lynx (softquoted string,full access)
herbivore deer (softquoted string,full access)
structure( animals1[], { mammal, bird, fish }, { dog, owl, eel} );
structure( animals1[mammal], { carnivore, herbivore }, { bear, deer } );
structure( animals2[], { mammal, fish, reptile }, { cat, trout, turtle } );
structure( animals2[mammal], { carnivore, omnivores }, { lynx, skunk } );
animals1[mammal] &<<= animals2[mammal];
// Lynx replaces bear, and the deer continues living.
see(animals1[]);
see(animals2[]);
animals1[] [Void] (void,full access)
bird owl (softquoted string,full access)
fish eel (softquoted string,full access)
mammal cat (softquoted string,full access)
carnivore lynx (softquoted string,full access)
herbivore deer (softquoted string,full access)
animals2[] [Void] (void,full access)
fish trout (softquoted string,full access)
reptile turtle (softquoted string,full access)
structure( animals1[], { mammal, bird, fish }, { dog, owl, eel} );
structure( animals1[mammal], { carnivore, herbivore }, { bear, deer } );
structure( animals2[], { mammal, fish, reptile }, { cat, trout, turtle } );
structure( animals2[mammal], { carnivore, omnivores }, { lynx, skunk } );
animals1[] &<=> animals2[];
see(animals1[]); // animals1 gets cat, trout, lynx
see(animals2[]); // animals2 gets dog, eel and bear
animals1[] [Void] (void,full access)
bird owl (softquoted string,full access)
fish trout (softquoted string,full access)
mammal cat (softquoted string,full access)
carnivore lynx (softquoted string,full access)
herbivore deer (softquoted string,full access)
animals2[] [Void] (void,full access)
fish eel (softquoted string,full access)
mammal dog (softquoted string,full access)
carnivore bear (softquoted string,full access)
omnivores skunk (softquoted string,full access)
reptile turtle (softquoted string,full access)