About Spectre Rotate

Spectre supports rotate operations that can take an input flow and rotate columns into multiple rows. The Spectre rotate block can be used wherever an input operation is allowed—for example, as a child to a build tag or cplan tag.

The output consists of:

  • Columns that are not rotated
  • A heading column that helps identify which columns were rotated to create the row
  • Values columns where the rotated column values end up
  • Rows for the rotated columns

The basic syntax for a rotate block is:

 rotate {
      rotate-output-names "heading-col-name" "rotated-data-col-1" "rotated-data-col-2"...
      row-out "row-value" "source-col-1" "source-col-2" 
      row-out "row-value" "source-col-1" "source-col-2" 
    }

Consider the following table with Oscar winners for Best Actor and Best Actress. You can rotate it into a table organized by award.

Each row contains distinct items. One column describes all the items on the row (Year). On each row, Actor First and Actor Last represent the Best Actor winner, while Actress First and Actress Last represent the Best Actress winner.

Each row describes both an actor and an actress, each of which has an Award. Note that you can tell who's who based on which column they are in. Each has a First Name and a Last Name.

You can rotate the data in a cPlan as follows: