cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting and alignment issues in header with crystal reports

gh_cr05
Participant
0 Kudos

I have a subreport set up as follows:

There is a Width Adjustment formatting formula for the Results header in Details b as below

The X Position adjustment is:

if {@numberOfSpecifications} = 0 then 1000 else 0

The same formula for Width adjustment in Details c under ResultNameandUnits.

Everything works fine when the setting is as above.

HOWEVER, when I change the Table.Field under the Results header in Details c section to a formula: @format Result

It works fine if there is a value under the Specifications header i.e. {@numberOfSpecifications} <> 0. However, when the {@numberOfSpecifications} = 0, the Specifications column is suppressed and only the Results column is shown – which is fine so far.

The only problem is that in the above scenario the Results header moves to the right and does not align with the values below. See example report below

Why does adding a formula change the header’s position. I am really baffled.

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

If I understand correctly, you're trying to make the header not show under certain conditions - is that correct?

Instead of playing with the width, I might try right-clicking on the object and going to "Format...", clicking on the formula button to the right of the Suppress checkbox (DO NOT check the checkbox!) and using the formula there to suppress the header instead of changing its width.

The other thing I see is that the width of the data objects in the column doesn't match the width of the column headers. If your pic4 is an image of the report as exported to another format, that can cause similar issues to this - you need to make sure that everything in a column is the same width and that the left and right sides line up as you move down the column.

-Dell

gh_cr05
Participant

Thanks Dell. Will give this a go. I inherited this report from some else and working my way through it.

I tried your suggestion and it works perfectly. Got rid of all the width adjustment formulae and added the suppression as required.

Thanks a million for this

Geeta

Answers (1)

Answers (1)

abhilash_kumar
Active Contributor
0 Kudos

The other thing you might want to try is create a new header formula and a detail formula that dynamically displays either results or specificaitons.

The header formula would output either "Results" or "Specifications" depending on whether the detail level formula for "results" contains data or not.

E.g the @results formula on the details would be:

If <code for results> <> 0 then <show results>
else if <code for specifications> <> 0 then <show specifications>

the header for results would be:

If Max(@results) <> 0 then "Results"
else if Max(@specifications) <> 0 "Specifications"

You can then simply suppress both the Header and detail formula for specifications using this code:

{@results} = 0 

-Abhilash

gh_cr05
Participant
0 Kudos

One clarification: there will always be Results. Specifications may or may not be there.

abhilash_kumar
Active Contributor
0 Kudos

Ah I see. Then the simple suppression of specifications, as Dell suggested, should do the trick.

I assumed that you wanted to move the header for specifications and its detail fields in place of results when results is blank.

-Abhilash

gh_cr05
Participant
0 Kudos

All good. Thanks.