Print Page | Close Window

Formatting crosstab values based on row value

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22308
Printed Date: 28 Apr 2024 at 2:42am


Topic: Formatting crosstab values based on row value
Posted By: subashp
Subject: Formatting crosstab values based on row value
Date Posted: 22 May 2017 at 12:06am
Hi All,

I have a requirement in Cross Tab report like below.

      Sal      Operations
1995 100      250
1996 200      450
.
.
2015 350      850
2016 500      540

We are passing year value in the report. When ever the Year value equals to parameter value then it should be BOLD and Font Size 12.
This one i have achieved.
At the same time the particular values in the row i.e. Sal and Operations also should be BOLD and Font Size 12.
For these values i am not able to achieve.

Please help me on this issue.

Thanks,
Subash



Replies:
Posted By: Valert16
Date Posted: 22 May 2017 at 11:20pm
You can get it using the GridLabelAt function. Use a conditional formating formula for font style and size of every value you want to highlight.
Font style:
If GridLabelAt ("NameOfYearRow", CurrentRowIndex) = {?NameOfYearParam} Then crBold Else DefaultAttribute

Font size (supposing 10 as original size):
If GridLabelAt ("NameOfYearRow", CurrentRowIndex) = {?NameOfYearParam} Then DefaultAttribute + 2 Else DefaultAttribute


Posted By: subashp
Date Posted: 23 May 2017 at 8:04pm
Hi,

Thanks for your reply.

When i am using the formula which you mentioned ...
If GridLabelAt ("NameOfYearRow", CurrentRowIndex) = {?NameOfYearParam} Then crBold Else DefaultAttribute

getting error like "A string is required here".

It is highlighting on "NameOfYearRow" place.
For this i have converted numeric column to text.

Even though i am getting the error.

Please suggest me on this.

Thanks,
Subash


Posted By: Valert16
Date Posted: 23 May 2017 at 11:25pm
Hi,
The error says that Crystal expects a valid string as the first parameter of GridLabelAt function.
You must replace the string "NameOfYearRow" (mantaining quotation marks) with the year field name in your crosstab. No need to change any data type.
e.g., if the year field name is MyTable.MyYear, you must type "MyTable.MyYear" (without curly brackets). Or, if it is a formula field named @year, then you should type "@year".
(I'm supposing you're not using an alias for the year field).
Hope this works.


Posted By: subashp
Date Posted: 24 May 2017 at 12:34am
Hi,

Thank you very much ... it is working fine now.

-- Subash



Print Page | Close Window