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
    removeMeasure(getMeasure(count-1));
    }

Screenshot of selecting “No”:

HowToRemoveColumnInCube-SelectNo

Screenshot of selecting “Yes”:

HowToRemoveColumnInCube-SelectYes

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