Skip to content

PIVOT_CATEGORIES

Action

Bases: BaseCategoryAction

Convert row-level categories into field categorisations.

Script template

"PIVOT_CATEGORIES > 'destination_field' < 'source_field'::[int, int, int, etc.]"

Where int contains the rows that define the categories, and field are the fields to include. Makes several assumptions:

  • Rows may contain more than one category
  • All terms in indexed rows in the same field are related
  • Categories are assigned downwards to all rows between indices
  • The last indexed category is assigned to all rows to the end of the table

Example

"PIVOT_CATEGORIES > 'NewField' < 'Field'::[1, 5]"

Will transform:

ID Field
1 Cat1
2 Term2
3 Term3
4 Term4
5 Cat2
6 Term6
7 Term7
8 Term8

To:

ID Field NewField
2 Term2 Cat1
3 Term3 Cat1
4 Term4 Cat1
6 Term6 Cat2
7 Term7 Cat2
8 Term8 Cat2