merge
merge
combines two or more tables into one aggregate table. This essentially appends the tables one on top of the other. Null tables are ignored.
Syntax
merge(tables...)
merge(theList)
Parameters
Parameter | Type | Description |
---|---|---|
tables | Table... | Source tables to be merged.
|
tables | Collection<Table> | Source tables to be merged.
|
theList | List<Table> | Source tables to be merged.
|
Returns
A new table with the source tables stacked one on top of the other. The resulting table's rows will maintain the same order as the source tables. If the source tables tick, rows will be inserted within the merged table where they appear in the source (rather than at the end of the merged table).
Examples
In the following example, source1
is stacked on top of source2
.
source1 = newTable(col("Letter", "A", "B", "D"), col("Number", 1, 2, 3))
source2 = newTable(col("Letter", "C", "D", "E"), col("Number", 14, 15, 16))
result = merge(source1, source2)
- source1
- source2
- result
In the following example, three tables are merged.
source1 = newTable(col("Letter", "A", "B", "D"), col("Number", 1, 2, 3))
source2 = newTable(col("Letter", "C", "D", "E"), col("Number", 14, 15, 16))
source3 = newTable(col("Letter", "E", "F", "A"), col("Number", 22, 25, 27))
result = merge(source1, source2, source3)
- source1
- source2
- source3
- result
In the following example, three tables are merged using an array of tables.
source1 = newTable(col("Letter", "A", "B", "D"), col("Number", 1, 2, 3))
source2 = newTable(col("Letter", "C", "D", "E"), col("Number", 14, 15, 16))
source3 = newTable(col("Letter", "E", "F", "A"), col("Number", 22, 25, 27))
tableArray = [source1, source2, source3]
result = merge(tableArray)
- source1
- source2
- source3
- result