Dynamic Data Pivot

Created by @dwhite


An example of how to perform a dynamic pivot on data that needs to be pivoted. The traditional Pivot Snap is static and has to be configured per set of data (Ex. in pipeline). This pipeline shows how one can perform a pivot operation on data with variable fields that could be sent in at runtime instead, so pivot configuration could be done on the fly during the run.

Configuration

Configure dynamic pivot via parameter values. Enter the number of fields to split to in “nSplitFields” parameter. Enter the field names that are being split in the “splitFields” Parameter in a comma separated list. Enter new fields to generate in the “genFields” parameter in a comma separated list.

For actual use, remove the sample data and traditional Pivot, those are only for demonstration and comparison.

Sources: Any flat datasource that needs pivoting
Targets: Any
Snaps used: CSV Generator, Copy, Pivot, Mapper, Sequence, Join, JSON Splitter, Group by n

Downloads

Dynamic Data Pivot.slp (15.7 KB)

2 Likes

This is fantastic! I was looking for a way to dynamically pivot without having to hard code the columns in a Pivot Snap since the number of columns I wanted to pivot on was changing. Thanks!