Adding an Expand Set with a Parameter

You can use parameters with expansion sets to further the flexibility of your scripts. This examples shows how to use a parameter with time series columns to minimize the scripting for multiple years.

  1. In Workbench, open the appropriate script for the page needing expansions. For example data_expand-param.divetab.
  2. In the page's definitions block, type in the expand-set tag followed by an id attribute and value followed by an open brace. For example:

      expand-set id = "es-YTD-MTD" { 
  3. Define a parameter. For example:

      take-parameter "value" 
  4. Add the expand tag followed by the text to display in the context menu. For example:

      expand "$(value) YTD" 
  5. To add columns, add an open brace, {, to the end of the line.
  6. Add text and column tags as appropriate. For example:

      text "Last YTD" column = "$(value) YTD Y-1" { 
        value-format "$#,###.00" 
      } 
      text "% Var YTD" column = "$(value) YTD Y-0 % Diff" { 
        value-format "%#,###.00" 
      } 
  7. Add a closing brace, }, for the expand block.
  8. Repeat Steps 2 through 7 for the second expand block. Here is an example of a Closeddefinitions block with the two expand blocks.

      definitions { 
        expand-set id = "es-YTD-MTD" { 
          take-parameter "value" 
          
          expand "$(value) YTD" { 
            text "Last YTD" column = "$(value) YTD Y-1" { 
              value-format "$#,###.00" 
            } 
            text "% Var YTD" column = "$(value) YTD Y-0 % Diff" { 
              value-format "%#,###.00" 
            } 
          } 
          
          expand "$(value) MTD" { 
            text "MTD TY" column = "$(value) MTD" { 
              value-format "$#,###.00" 
            } 
            text "MTD LY" column = "$(value) MTD Y-1" { 
              value-format "$#,###.00" 
            } 
            text "MTD % Var" column = "$(value) MTD Y-0 % Diff" { 
              value-format "%#,###.0" 
            } 
          } 
        } 
      } 
  9. Add a close brace, }, to end the expand-set block.
  10. Define the column-set. Here is an Closedexample of a column-set.

      column-set id = "cs-viewall" { 
        text column = "Cost YTD" { 
          value-format "$#,###.00" 
          expand-set id = "es-YTD-MTD" { 
            pass-parameter "value" "Cost" 
          } 
        } 
        text column = "Net Sales YTD" { 
          value-format "$#,###.00" 
          expand-set id = "es-YTD-MTD" { 
            pass-parameter "value" "Net Sales" 
          } 
        } 
      } 
  11. Use the column-set in the page block. Here is an example of a Closeddata-area using the column-set.

      data-area id = "NY Data" { 
        title "Expand Set with a Parameter" 
        icon "/divetab/images/menu icons/22.png" 
        sections { 
          
          report-page { 
            title "Expand Set 1" 
            cplan "/cplans/expand-time-series.cplan" 
            
            quickview-set { 
              cplan "/cplans/expand-time-series.cplan" 
              dimension-quickview "Current Date" single-selection = true all-values = false { 
                dimension "Posting Period" 
                default-values "2013-02" 
                default-last-value 
              } 
            } 
            dimension "Corporate Supplier" 
            column-set id = "cs-viewall" 
          } 
        } 
      } 

Here is the Closedresult of the code with the expand sets collapsed.

Here is the Closedcontext menu for the page.

Here is the Closedresult of the code with the YTD columns expanded.

The Expand YTD is opened for both Cost and Net Sales.

Here is the Closedresult of the code with the MTD columns expanded.

The Expand MTD is opened for both Cost and Net Sales.

See also Adding Column Sets