Column and Expand Set Parameter Code Samples

Here is an example of a Closedcolumn-set that uses a parameter to control both the data and its heading.

  definitions { 
    column-set id = "cs-pastyears" { 
      take-parameter "summary" 
      text "$(summary)" column = "$(summary)" 
      text "$(summary) Y" column = "$(summary) Y" 
      text "$(summary) Y-1" column = "$(summary) Y Y-1" 
    } 
  } 
  data-area id = "data-area-1" { 
    title "Parameters Sample" 
    icon "/divetab-script/images/trends.png" 
    
    sections { 
      report-page { 
        title "Column Set Parameters" 
        cplan "/cplans/basic_timeseries.cplan" 
        dimension "Resp Team" 
        column-set id = "cs-pastyears" { 
          pass-parameter "summary" "Cases" 
        } 
      } 
    } 
  } 

This is the Closedthe result of the code in DiveTab.

 Example of a report page using a column set parameter.

The take-parameter tag identifies summary as the placeholder value, so every "$(summary)" used in the column-set is marked as a variable.

The pass-parameter tag identifies which placeholder value it replaces and the replacing value. The first argument for pass-parameter identifies the take-parameter variable; the second argument is the value for that variable. For this example, pass-parameter replaces the take-parameter summary variable with the Cases summary.

The same column-set can be used multiple times with different pass-parameters. For example, a second column-set could use Cost for the pass-parameter.

Here is a more customized example with Closedcolumn-sets and expand-sets, and two parameter values in use.

  definitions { 
    column-set id = "cs-pastyears-param" { 
      take-parameter "summary" 
      text "$(summary)" column = "$(summary)" { 
        expand "Past Years" { 
          text "$(summary) Y-1" column = "$(summary) Y Y-1" 
          text "$(summary) Y-2" column = "$(summary) Y Y-2" 
        } 
        expand "Quarters" { 
          text "Q1" column = "$(summary) Q1 Y-1" 
          text "Q2" column = "$(summary) Q2 Y-1" 
          text "Q3" column = "$(summary) Q3 Y-1" 
          text "Q4" column = "$(summary) Q4 Y-1" 
        } 
      } 
    } 
  } 
  
  data-area id = "data-area-1" { 
    title "Parameters Sample" 
    icon "/divetab/images/trends.png" 
    
    sections { 
      report-page { 
        title "RP - Parameters" 
        cplan "/cplans/basic_timeseries.cplan" 
        
        dimension "Resp Team" 
        
        column-set id = "cs-pastyears-param" { 
          pass-parameter "summary" "Cases" 
        } 
        column-set id = "cs-pastyears-param" { 
          pass-parameter "summary" "Cost" 
        } 
      } 
    } 
  } 

This is the Closedresult of the code in DiveTab, showing the Quarters expand for Cost.

Example of another report page using two column sets with parameters.

The expand for Past Years is not shown.

See also: