Skip to Content

Cross-tab row formatting inconsistent

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>

example1.PNG (8.4 kB)
example2.PNG (5.3 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Aug 06, 2012 at 11:06 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 26, 2012 at 03:15 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

  • author's profile photo Former Member
    Former Member
    Posted on Aug 02, 2012 at 10:00 PM

    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?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 26, 2012 at 10:02 PM

    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

    Share Your Knowledge in SCN Topic Spaces

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 02, 2012 at 08:57 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.