Crystal Reports & SQL Reporting Services Training Consultants
Account Log in:
Username:
Password:
A single reason why you can do something is worth a hundred reasons why you can't
 
Institute of IT Trainers - Freelance Trainer of the Year 2006 & 2009
Liverpool Business Connect Member
  Maximum Impact Solutions Limited - Reporting Solutions, Creating Answers
Reporting Solutions - Creating Answers, Crystal Reports, Dashboarding (Xcelsius) & SQL Reporting Services

The Maximum Impact Solutions Blog Feed ME!!!!

05
May

How Do I Dynamically Change the Fields and Field Positions in Crystal Reports XI?

A client recently asked how does one dynamically change the report fields and their field relative positions on a report in Crystal Reports XI?

The client wanted to be able to select specific fields to be displayed on a report, and remove the inevitable spaces that would result, when certain fields were not displayed.


Solution:

The key to this solution is to use the twips measurement, which is 1/1440 of an inch measurement, to move the fields into the spaces of the suppressed fields.

  1. Create the report and add the required fields to the report canvas

  2. Create a parameter which allows the user to select which field(s) are to be omitted from the report

  3. Select the first field and its corresponding header of the report

  4. Right click on the selection and select Format Objects

  5. In the Format Editor dialog box, on the General Tab, ress the Conditional Format button [x+2] button for the Suppress option

  6. In the Formula Workshop enter the following formula:

                     {?Parameter Field} = "Parameter Value"

  7. Press the [Save & Close] button

  8. Press the OK button of the Format Editor dialog box

  9. Repeat steps 3 - 8 for the other fields of the report

  10. Right click on the second field of the report, and select the Size and Position menu option

  11. In the Object Size and Position dialog box press the Conditional Format button [x+2] button for the X option

  12. Enter the following formula:

                   if {?Parameter Field} = "Paramater Value" then -2880


    Note: -ve twip  moves the column to the left and +ve twip move the column to the right

  13. Press the [Save & Close] button

  14. Press the OK button of the Format Editor dialog box

  15. Right click on the heading of second field of the report, and select the Size and Position menu option

  16. In the Object Size and Position dialog box press the Conditional Format button [x+2] button for the X option

  17. Enter the following formula:

                   if {?Parameter Field} = "Paramater Value" then -2880

  18. Press the [Save & Close] button

  19. Press the OK button of the Format Editor dialog box

  20. Repeat steps 10 - 19 for all the other fields of the report, amending the X position conditional formula accordingly



If you have any questions, or need any assistance, please do not hesitate to Contact Us
1

Gokul

25
December
well i will try the following steps thanks in advance
2

Devina

29
May
That formula is not being accepted in the conditional format window of size and position option. what else can i do?
3

Devina

29
May
It throws me an error saying " A number, currency amount, boolean,date,time,date-time, or string is expected here" The formula that i am using is' if ({?Select the Fields} != ‘Related Resolution’ AND {?Select the Fields} = ‘Gating’) then -2160
4

Julia

02
August
Hi Devina, It seems that it has something to do with the set up of your parameter, and/or the data type that has been set is not the same as the one used in for conditional formula

MAKE A COMMENT

Name *

Email Address *

Comment *

To prove you are human what is:

6 + 47 =