04-04-2022 11:03 AM
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.
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
Dynamic Data Pivot.slp (15.7 KB)
04-25-2022 07:11 AM
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!