[Excel] How To Create Dynamic Columns Based On Range

This recipe shows how to create dynamic columns based on range.

Steps taken:

  1. Create a report template (AgingReport.rml) using the composite datasource (Calculation.ds).
  2. Define the following parameters into “Report > Parameters” tab page:(Param1) Name=min, Value=${min##30}
    (Param2) Name=range, Value=${range##30}
    (Param3) Name=snapP, Value=${snapP#choice(Yes,No)#Yes}
  3. Enter the following script:
  4. On “Report Properties > On Render End” tab:rd = this.getRenderDetails(“application/vnd.ms-excel”);
    if (rd==null) // no render details for this mime-type stored
    {
    // create a RenderDetails for the right type and add it to the report
    rd = new RenderDetails();
    rd.setMimeType(“application/vnd.ms-excel”);
    this.addRenderDetails(rd);
    }
    rd.setParameterValue(“Snap”,Properties.getProperty(“snapP”));
  5. On “Functions > On Render Begin”:determineRange(Properties.getProperty(“min”),Properties.getProperty(“range”))
  6. Enter the correct script for each data field, as shown in the “Layout” tab page of the report template (AgingReport.rml).

To download the necessary files for this recipe, refer to the attached ZIP file.
HowToDynamicColumnWithRange.zip (6.5 KB)