Once you retrieve your view metadata and grid data, map the column and row items for your transformation.

To map your items:

  1. Map the column indices with the applicable column items.  
    If columns have more than one dimension, map the column indices to multiple items. 
  2. Map the row items by column. 

With the retrieved data, we now map the column items and row items.

We now map the column indices to the column items that apply to it. For example, column 1 with value 10 uses UK as its column item, column 2 uses France, column 3 uses Germany, and column 4 uses Total Company.
In the view metadata, we can see that there are pages on this view so we do not need to process the first line. We know: 

  • There is only one dimension on columns, which means we need to process only the next line of the grid response in order to map all columns. 
  • We also skip the first n columns where n is the number of row dimensions as those entries in the grid response are the labels for items on rows:

           1  2      3       4
         ,UK,France,Germany,Total Company
Units Sold,10,20    ,30     ,60

The ColumnItems map is now: { 1 → UK; 2 → France; 3 → Germany; 4 → Total Company }

If there is more than one dimension on columns, the column indices map to multiple items. For example: { 1 → UK, Alice ; 2 → UK, Bob ; 3 → France, Alice … }

If there are no dimensions on columns, you can set the map to be either empty, or have a key-value pair of { 1 -> null }

Note that this entry should not add an extra column when building the output. This entry is used to extract the cell data as the values still appear in a column inside the view.

Now map the row items. We use the first column of the grid response that contains the row items but we do not process the pages row and the row that contains the dimension items. 

We only need to process the first column of the rest of the response, because there is only one dimension on rows:

1     Units Sold,10 ,20 ,30 ,60
2     Produced  ,100,200,300,600

The RowItems map now looks like { 1 → Units Sold; 2 → Produced }.