Crystal Reports on the web

Looking at the huge number of links, my code snippets and samples that I've accumulated during my journey with Crystal Reports and Report Server (RAS), I've realized that something should be done with all that. So, for all who are struggling with similar problems I've faced while pursuing that elusive goal of putting Crystal Reports on the web, I will put as much information here as I can ...

Tuesday, August 21, 2007

Conditional X position change

I had an interesting problem today - to move logo from upper left side to upper right side of the report, conditionally, only for certain companies...
Well, it got interesting when whatever I would enter into formula field next to X coordinate of my picture, got ignored. Nothing will happen, logo will stay at the same place... I've tried one inch, 5 inches, 20 inches... nothing
I've finally found a problem - coordinates on the screen are in inches, but formula is in twips. So great, really.
My changes were too small since one inch has 1440 twips, so I couldn't see any difference in position... As soon as I've entered 12000 logo jumped to the end of the page. Problem solved :)

Here is the text that helped me solved the problem (from Crystal Reports XI User Guide)

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
To conditionally change the X position of an object
1. Right-click the field that you want to move conditionally, and select Size
and Position.
2. Click the Conditional Formula button next to the X position value field.
3. In the Formula Workshop, enter your conditional X position formula text.
For example, to move orders that were shipped late to a second column,
enter formula text such as this:
If (Orders.Ship Date) < CDateTime (2004, 01, 01, 02, 10,
11) then 4320
Note: The number 4320 represents the new position that you want to
define as the second column. The position is measured in twips; there
are 1440 twips in an inch.
4. Click Save and close to return to your report.
5. Click OK to save your position setting.

Crystal Reports moves objects that meet your condition to a new position, but
leaves those objects that don’t meet the condition where you originally placed
them.

8 Comments:

  • At 1:45 PM, Anonymous Anonymous said…

    Great dear,

    I tried out since 3 hours to move one field to another position and I tried to change as 2 or 3 inch, but nothing was happned.

    And I came across your post and my problem has solved.

    Thanks ........

    - Taker

     
  • At 2:56 PM, Anonymous Anonymous said…

    FYI, the text from the manual seems to imply that the positions you specify in the formula are absolute. In CR XIR2, they seem to be relative.

     
  • At 6:48 AM, Anonymous Anonymous said…

    Thanks for writing this.

     
  • At 4:14 PM, Blogger rhoda said…

    thanks..you helped me solve this problem of conditionally moving objects from the margin..

     
  • At 2:39 PM, Anonymous Anonymous said…

    What about the y position. Can it be done conditional???

     
  • At 1:53 PM, Blogger Branka said…

    I'm glad that this was of help to somebody - it took me a long time to find documentation for this. Now, since it's SAP company, documentation is even worse :(

    BTW, I'm using still CR XI, not Release 2...

     
  • At 11:47 PM, Blogger Hira Masood said…

    :D
    So many thanx

     
  • At 10:27 AM, Blogger Unknown said…

    Hi, i am trying to move the subreport position in a main report usign the above suggestion. But it is takign the value that is mentioned in the X field rather taking the value from the formula

     

Post a Comment

<< Home