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 the Product manager for InfoBurst, Infosol’s flagship product. With more than a decade of demonstrated success assisting large entities, he is continually helping clients with their implementations using technologies such as Business Objects, Tableau, Power BI, SAP HANA and BW. He is responsible for product development initiatives through vision, strategy and roadmap development for InfoBurst.

Check Also

Tech Tip: Merging on Variables in Web Intelligence

One of the often overlooked additions given to us in the 4.2 SP3 release was ...