How To Remove Column In Cube

This recipe shows how you can remove extra column in cube by using Java code.

  1. Create a report template (DynamicCube.rml) using the given datasource (FruitSales.ds).
  2. Define the following parameter in the “Report > Parameters” page:Name = RemoveColumn, Value = ${Remove Column#choice(Yes,No)#No}
  3. Add a cube into the report template. Add the coding into “Cube Properties > Scripts > On Render Begin”:if (“Yes”==Parameters.get(“RemoveColumn”))
    { var count = getMeasureCount();
    if (count>1) // only remove if more than one measure present

Screenshot of selecting “No”:


Screenshot of selecting “Yes”:


To download the necessary files for this recipe, refer to the attached ZIP package. (3.6 KB)