• esProc
Tutorial
Function Reference
User Reference
External Library Guide
Data File Tool Manual
DQL Tutorial
Cluster Server Manager Manual
SPL WIN Manual
• YModel
User Reference
JSON-style Parameter Guide
• ReportLite
User Reference
• Official Website

# xunion()

Description:

Generate a new sequence by uniting and rearranging distinct members in all member sequences.

Syntax:

A.xunion(x)

Note:

Over sequence A whose members are also sequences, the function forms a new sequence by uniting and rearranging distinct members in all member sequences. A duplicate member only be removed once.

The rule is this: the function first gets a difference sequence between A(1) and A(2), and then the difference sequence between A(2) and A(1), then the concatenation sequence of two difference sequences, then repeat same operations on the concatenation result and A(3), and so on and so forth.

When parameter x is present, first compute the expression x with memers of sequence A and then perform the rearrangement process.

Parameter:

 A A sequence consisting of sequences x An expression whose value is a sequence; cannot be omitted when members of A are table sequences or record sequences

Return value:

Sequence

Example:

When members of A are sequences:

 A 1 =[[1,2,3,3,4],[1,1,3]].xunion() [2,3,4,1] 2 =[[1,2,3,3,4],[1,1,3],[4]].xunion() [2,3,1] 3 =[[1,2],[]].xunion() [1,2] 4 =[[1,2,2,2],[1,2]].xunion() [2,2]; only one duplicate member in the same sub-sequence is removed.

When members of A are table sequences or record sequences:

 A 1 =demo.query("select * from STUDENTS where ID>3") 2 =demo.query("select * from STUDENTS1") 3 =[A1,A2].xunion(~.(NAME)) Compute expression on members of sequence [A1,A2] to retrieve NAME field from both, and unite and rearrange different members of the sub-sequences into a new sequence, and return ["Michael","John","Nicholas","Emily","Elizabeth","Sean"].

Related function: