1. Data integration
  2. Anaplan API Guide and Reference
  3. Use the transactional APIs
  4. Transform Grid CSV to Tabular Single Column format
  5. Retrieve the view metadata and grid view data

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 will not need it for the transformation.

Example

In the following module view, we will transform the Grid CSV output to TSC format.

Module grid view

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

Target output 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

Retrieve the view metadata

To construct the first line of the TSC format, we retrieve the metadata for the view as it contains the names of the dimensions, as well as information that will be useful later, such as the number of dimensions on rows and columns.

In this example,  we assume that the output headers follow the order within the metadata response, with pages dimensions being first, followed by dimensions on columns , dimensions on rows and Value at the end.

Retrieve the grid view data

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.

Extract the page items

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]