Pivot

Takes two parameters, FieldBase, PivotField

Description:

The WorkQuery will be transformed such that Records will be swapped as Fields and the Fields will be swapped as Records. The optional PivotField will become the first Field in the Query and remain in place, while the rest of the data is flipped.

If PivotField is not specified, then before the data is flipped a new Field named PivotName will be created and the first Record will have that Field set to PivotValue1, and so on. This allows for access to incoming Fields via simple Named/Value pairs without a fixed requirement ahead of time on which Fields might be arriving.

Example:

Before

FieldOne | FieldTwo | FieldThree
D11 | D21 | D31
D12 | D22 | D32

After

FieldOne | D11 | D12
FieldTwo | D21 | D23
FieldThree | D31 | D32