Aternating shading in the report details lines

I have taken responsibility for a Crystal Report.  
Because it summarises information, it does not print any detail lines or group headers or footers.  
But in the report footer it lists a number of lines of summarised information.
I have been asked to alternate the shading of the lines.
If this was a detail line I could use
if (recordnumber mod 2 = 0)
then crNoColor
else crSilver

But this does not work, presumably because the recordnumber is not incremented.
Any ideas?
Nigel Keith-WalkerContractorAsked:
Who is Participating?
 
mlmccCommented:
They are cross tabs in the subreports

Try this in the cells

WhilePrintingRecords;
Global NumberVar Rownum;
Rownum := Rownum + 1;

If RowNum mod 2 = 1 then
    crSilver
Else If RowNum mod 2 = 0 then
    crNoColor

You may also need to add a formula like this to the total row cel
WhilePrintingRecords;
Global NumberVar Rownum;
//if CStr(GridRowColumnValue ("Orders.Order Date"),"MMM yy") = "Feb 03" then
Rownum := 0
crNoColor

I needed the second formula because I had an odd number of rows in the cross tab.
It seems it runs the formula for each cell from top to bottom then moves right to the next column

mlmcc
0
 
peter57rCommented:
The only method I know of doing what you describe, without using a subreport, would make it impossible to do what you are asking.

If you are not currently using a subreport then that would be your only route to meeting this requirement, using the method you already know.

But without knowing exactly how your report is currently working, it is difficult to do anything other than guess.
0
 
peter57rCommented:
The only method I know of doing what you describe (producing a summary at the bottom), without using a subreport, would make it impossible to do what you are asking (alternate colours).

0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
mlmccCommented:
I can think of 2 methods of doing this based on how the summary is produced.

Method 1
Assumes you have separate lines for each summary item
RF
     {@DispPart1Name}    {@DispPart1Sales}
     {@DispPart2Name}    {@DispPart2Sales}
     {@DispPart3Name}    {@DispPart3Sales}

You could put each line in its own section and format them to alternate colors
RFa
     {@DispPart1Name}    {@DispPart1Sales}
RFb
     {@DispPart2Name}    {@DispPart2Sales}
RFc
     {@DispPart3Name}    {@DispPart3Sales}


Method 2
Assumes you have arrays with the information and are using a formula to convert to tet for display.

Add codes to use HTML or RTF  to change the font color or text highlighting

mlmcc
0
 
Nigel Keith-WalkerContractorAuthor Commented:
Hmm.  The report does use a sub-report.  The main report has two report footers: a and b.
Each of these footers has group #1, Group #2 but it is summarised and printed in the report footer.
So  the recordnumber will not be incremented.  
Will I have to explain to my user that it cannot shade alternate lines without a re-write?
0
 
mlmccCommented:
Can you upload the report?

Footers don't have groups

mlmcc
0
 
Nigel Keith-WalkerContractorAuthor Commented:
OK.  Slack explanation!
The main report has a two footers each with a sub-report.
The sub-report has a footer.
I have put in a couple of screenshots: Main report and sub-report. Crystal-main-report.pdf
0
 
peter57rCommented:
So does this whole question boil down to ..
"Can I do alternating row colours in a crosstab?"
0
 
Nigel Keith-WalkerContractorAuthor Commented:
It is posible that it is a cross tabulation.
It presents the detail data across the 12 months and totals for the year.

0
 
mlmccCommented:
The method of alternating colors depends totally on the method used to present the data.  I didn't think of a cross tab but it can be done there also.

Crystal comes with a cross tab example that I believe alternates colors.

mlmcc
0
 
peter57rCommented:
To do alternate rows in a crosstab you have to conditionally format every cell in the row (in design view).

You can use an expression like this in the conditional format for the cell background..

if CurrentRowIndex mod 2 = 0 then
crwhite
else
crsilver
 
0
 
Nigel Keith-WalkerContractorAuthor Commented:
I will try this on Monday, when I am back at work.
0
 
Nigel Keith-WalkerContractorAuthor Commented:
When I put the coding
if CurrentRowIndex mod 2 = 0 then
crwhite
else
crsilver

In the CrossTab1/Background Color(Field - Row: Ops Table.Actnum

I get the error
A number, currency amount, boolean, date, time date-time or sting is expected here.
There is no help on CurrentRowIndex in the online help for Crystal XI

Any ideas?
0
 
mlmccCommented:
WHere did you put the code?

It goes in the formula for highlighting or background for a cell of the cross tab format.

mlmcc
0
 
Nigel Keith-WalkerContractorAuthor Commented:
I have determined that it is not a cross-tab.  I checked it out by right clicking. I had to try insering a cross tab to see what it actually looked like.  Sorry for misleading you.
0
 
peter57rCommented:
The fields [Row #1 Name], [Row #3 Name] (and I'm guessing that the thin white gap between them says [row #2 Name]) are only found in a crosstab.

I am puzzled about exactly how the arrangememt of fields is achieved., though.

Can you post the subreport so that we can look at the structure.
Capture3.JPG
0
 
mlmccCommented:
Can you upload the RPT file?

mlmcc
0
 
Nigel Keith-WalkerContractorAuthor Commented:
Ok.  Atached is the sub-report.  In the footer is the row name and the totals.
PSSalesForecast-BU-V1.rpt
0
 
mlmccCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.