How To Render Dynamic Columns

This recipe demonstrates the use of script to show columns based on selection parameter.

Sample Input :

= First =
COMPANYNAME,SALESREP,ORDERDATE,PURCHASEORDERNUMBER,
FREIGHTCHARGE,SALESTAXRATE,PRODUCTNAME,QUANTITY,
COSTPERKG,DISCOUNT

= Second =
SALESREP,ORDERDATE,FREIGHTCHARGE,SALESTAXRATE,QUANTITY,
COSTPERKG

Steps taken :

  1. Input parameter to determine the columns to display
  2. Script to extract each column from the input and insert into array- Written at Report’s Render Begin
  3. Function to return the label for each column- Written at Function Definitions for Global Access
  4. Condition at Render If determine rendering of column

Screenshot of choosing columns (parameters):

HowToRenderDynamicColumns-ChooseParam

Screenshot of the output based on selection:

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