Home / Tech Tips / Crystal Reports with Dynamic Report Field Selection – Part 1

Crystal Reports with Dynamic Report Field Selection – Part 1

Crystal Reports are very good for printable reports, but what if you don’t need every single field on the report? What If you had to dynamically change the report fields. This blog will help you in designing a crystal report with dynamic report fields.

Consider a crystal report with the following fields:

Crystal Report w Dynamic Report Field Selection 1

A user who wants to see only the Year, State & City fields needs to follow the steps below.

Step 1: Create the report and add the required fields to the report canvas

Step 2: Create a parameter which allows the user to select the fields that need to be displayed in the report. Make sure the setting “Allow Custom Values” is false and “Allow Multiple Values” is true

Crystal Report w Dynamic Report Field Selection 2

Step 3:  Select the “Year” field and its corresponding header, right click on the selection and select “Format Objects”

Crystal Report w Dynamic Report Field Selection 3

Step 4: In the format editor dialog box select “Suppress” option and click the condition format [X-2] and insert the formula shown. As per the formula, the “Year” field will not be displayed when the selection parameter is not equal to “Year”

Crystal Report w Dynamic Report Field Selection 4

Crystal Report w Dynamic Report Field Selection 5

Step 5: Repeat the steps 3 and 4 for all the remaining fields – State, City & Store name with following formulas respectively

{?Select the Fields} <> ‘State’

{?Select the Fields} <> ‘City’

{?Select the Fields} <> ‘Store Name’

Step 6: Execute the report and select “Year”, “State” and “City” from “available values” and click “OK”

Crystal Report w Dynamic Report Field Selection 6

Voila! The report displays only the three fields which were selected.

Crystal Report w Dynamic Report Field Selection 7

There might be a user who is interested in “Year”, “City” & “Store Names”. In that case, the report looks as shown below.

Crystal Report w Dynamic Report Field Selection 8

Even though it shows “Year”, “City” & “Store Name”, there’s an empty space between Year & City. Want to know how to remove these annoying spaces that show up, when certain fields were not displayed? Stay tuned for part 2 of my blog that will cover just that!

About Rajesh Ponnurangam

Rajesh Ponnurangam is a Senior Business Intelligence Consultant with Infosol. He is a SAP certified associate with extensive experience in design and development of Business Intelligence applications for apparel, retail, consumer goods and manufacturing industries. He specializes in Business Objects solutions, SAP HANA and BW data modeling. He has a proven track record in designing strategies for ETL, BI application development, implementation, rollout and support.

Check Also

InfoSol News: Keeping You in the Loop on All Things BI!

InfoSol sends out a monthly newsletter that will keep you up to date about Limitless BI ...