on 07-26-2012 12:26 PM
Hi
I have created a Crystal Report XI cross-tab with 3 columns.
I have built a background formula into the row header and data fields to provide alternater row background shading like the below.
This works fine when there is an even number of rows, but fails when there is an odd number of rows
In the formulas I use whileprintingrecords, and I am struggling to work out how to correct this behaviour - or even how whileprintingrecords increments the variables in these examples of even and odd rows.
My background formulas are as follows:
Row headers (e.g. July, Aug etc)
<code>whileprintingrecords;numbervar f1;f1 := iif(f1=1,0,1);iif(f1=0,color(197,217,241),color(255,255,255));</code>
'Usage' row data
<code>whileprintingrecords;numbervar f2;f2 := iif(f2=1,0,1);iif(f2=1,color(197,217,241),color(255,255,255));</code>
'%' row data
<code>whileprintingrecords;numbervar f3;f3 := iif(f3=1,0,1);iif(f3=1,color(197,217,241),color(255,255,255));</code>
'Value' row data
<code>whileprintingrecords;numbervar f4;f4 := iif(f4=1,0,1);iif(f4=1,color(197,217,241),color(255,255,255));</code>
Thanks for your suggestions everyone.
I was able to control the formatting by updating a formula to include a running total I have created which I could use to identify the number of rows that would be output
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bob,
What is the reason for this being a cross tab object? Can it not just be a dimensions and three running total or formula objects?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Bob,
Try resetting the 'data' variables in the headers using a nested reset formula. For instance, right click on the Usage header > format field and enter in the following conditional suppression formula;
numbervar f2:=0;
false
Regards,
Graham
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bob,
Is this a 'Crosstab' object?
I'm asking this because you really do not need to put these formulas in each 'column' of the crosstab.
When you select the summary fields in the crosstab, it selects all the columns.
Is this a manual crosstab?
- Abhilash
Follow us on Twitter
Got Enhancement ideas? Try the SAP Idea Place
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can u try using the same formula as row for the columns too
Like f2,f3,f4=0 ..try and let me know if it don't work
Thanks,
Jothi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the response Jothi.
It has the opposite effect.
When I applied the formula you suggested I find background formatting is OK where there is an odd number of rows, but fails in the same way when there is an even number of rows,
Is there a way to establish how many rows there would be in the cross-tab?
If it is an even number I can apply the background formula as I originally designed.
If it is an odd number I can apply the background formula as you had suggested.
Hi ,
If it is a crosstab then can you try below forula for coloring and also go thru the link.
http://www.tek-tips.com/viewthread.cfm?qid=1618459
Global NumberVar CountRow := CountRow + 1;
If CountRow Mod DistinctCount ({RowGroup.Field}) = 0 or
(CountRow Mod DistinctCount ({RowGroup.Field})) Mod 2 <> 0 Then
CrNoColor
Else
Color(238,238,238)
OR
Right-click on one of the values in the row label, select Format Field, click the conditional formatting button to the right of Background and enter the following formula:
IF Remainder (CurrentRowIndex, 2) <> 0
THEN Color (200, 200, 200)
ELSE crNoColor
Thanks,
Jothi
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.