This is an old revision of the document!


PHP's gd library is missing or unable to create PNG images

Set Table By Key

Description

This functor updates or inserts a sub-table corresponding to the given chain of keys in a table.

Inputs

Name Type Description
Table Table
Keys Tuple Chain of keys identifying the sub-table that will be updated or insert.
Sub Table Table Sub-table that will be inserted in the input table. The column names in the sub-table must match the corresponding names in the input table. The column types must also be compatible.

Outputs

Name Type Description
Result Table The resulting table.

Group

Notes

This functor inserts elements corresponding to the given tuple of keys in the input table. For example, given the table below

Key1* Key2* Key3* Value1 Value2 Value3
1 “a” 11 12 “bbbb” 23
1 “b” 22 12 “cccc” 23
2 “d” 22 12 “dddd” 12

inserting a sub-table corresponding to the tuple of keys <2, “a”>, where 2 corresponds to column “Key1” and “a” corresponds to column “Key2”,

Key3* Value1 Value2 Value3
11 12 “bbbb” 14
22 12 “aaaa” 23

yelds

Key1* Key2* Key3* Value1 Value2 Value3
1 “a” 11 12 “bbbb” 23
1 “b” 22 12 “cccc” 23
2 “a” 11 12 “bbbb” 14
2 “a” 22 12 “aaaa” 23
2 “d” 22 12 “dddd” 12

and inserting the sub-table corresponding to the tuple of keys <2>, where 2 corresponds to column “Key1”,

Key2* Key3* Value1 Value2 Value3
“a” 11 12 “bbbb” 14
“a” 22 12 “aaaa” 23
“d” 22 12 “dddd” 12

yelds

Key1* Key2* Key3* Value1 Value2 Value3
1 “a” 11 12 “bbbb” 23
1 “b” 22 12 “cccc” 23
2 “a” 11 12 “bbbb” 14
2 “a” 22 12 “aaaa” 23
2 “d” 22 12 “dddd” 12

If there is already a sub-table corresponding to the sub-table being inserted in the sub-table, the existent sub-table is replaced by the new sub-table. The same is true if the sub-table being inserted is empty. In this case, the existent sub-table is removed from the input table.

It is not possible to insert a sub-table indexed by keys from arbitrary key columns. For example, in the example above, it is not possible to insert a sub-table corresponding to keys <2, 22>, where 2 corresponds to the first column (“Key1”) and 22 corresponds to the third column (“Key3”). To do this, first reorder the key columns using the Reorder Table Columns functor.

Internal Name

SetTableByKey