To construct the tabular single column (TSC) format output, you need the metadata and grid data for the view. 

To retrieve the view metadata and grid data:

  1. Use the Retrieve metadata for dimensions on a view call to retrieve the view metadata.
    The response contains the names of dimensions as well as the number of dimensions on rows and columns.  This procedure assumes output headers follow the order in the metadata response.
  2. Use the Retrieve cell data for a view call to retrieve your grid view data. 
  3. Parse the first line of the grid view output and store it as a list.  
    If the view has no dimensions on pages, the list is empty and you don't need it for the transformation.

In the module view below, we change the Grid CSV (comma-separated values) output to TSC (Caligari TrueSpace Configuration) format.

Example of a grid view in Anaplan of the Sales Module. This view will be exported in the subsequent examples to TSC format.

Line Item,Products,Organization,Period,Value
Units Sold,Apples,UK,2014-01,10
Units Sold,Apples,France,2014-01,20
Units Sold,Apples,Germany,2014-01,30
Produced,Apples,UK,2014-01,100
Produced,Apples,France,2014-01,200
Produced,Apples,Germany,2014-01,300

To construct the first line of the TSC format, you retrieve the metadata for the view as it contains the names of the dimensions.  You can also retrieve other useful information, such as the number of dimensions on rows and columns.

In this example, you can assume that the output headers follow the order within the metadata response. The pages dimensions are first, followed by dimensions on columns, dimensions on rows and Value last.

We retrieve the cell data for the view using the API. 

Jan 14    ,Apples
         ,UK     ,France,Germany,Total Company
Units Sold,10     ,20    ,30     ,60
Produced  ,100    ,200   ,300    ,600

Whitespace is added to this example response for readability.

To extract the page items, we parse the first line of the Grid output and store it as a list called PageItems:

PageItems = [Jan14; Apples]