[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Aternating shading in the report details lines

Posted on 2011-10-25
20
Medium Priority
?
288 Views
Last Modified: 2012-05-12
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?
0
Comment
Question by:Nigel Keith-Walker
  • 7
  • 7
  • 5
19 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 37029600
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
 
LVL 77

Expert Comment

by:peter57r
ID: 37029925
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
 
LVL 101

Expert Comment

by:mlmcc
ID: 37031296
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
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 

Author Comment

by:Nigel Keith-Walker
ID: 37035610
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
 
LVL 101

Expert Comment

by:mlmcc
ID: 37036092
Can you upload the report?

Footers don't have groups

mlmcc
0
 

Author Comment

by:Nigel Keith-Walker
ID: 37043147
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
 
LVL 77

Expert Comment

by:peter57r
ID: 37043246
So does this whole question boil down to ..
"Can I do alternating row colours in a crosstab?"
0
 

Author Comment

by:Nigel Keith-Walker
ID: 37044200
It is posible that it is a cross tabulation.
It presents the detail data across the 12 months and totals for the year.

0
 
LVL 101

Expert Comment

by:mlmcc
ID: 37044738
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
 
LVL 77

Expert Comment

by:peter57r
ID: 37045384
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
 

Author Comment

by:Nigel Keith-Walker
ID: 37049012
I will try this on Monday, when I am back at work.
0
 

Author Comment

by:Nigel Keith-Walker
ID: 37054971
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
 
LVL 101

Expert Comment

by:mlmcc
ID: 37055020
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
 

Author Comment

by:Nigel Keith-Walker
ID: 37060760
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
 
LVL 77

Expert Comment

by:peter57r
ID: 37061446
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
 
LVL 101

Expert Comment

by:mlmcc
ID: 37064367
Can you upload the RPT file?

mlmcc
0
 

Author Comment

by:Nigel Keith-Walker
ID: 37067450
Ok.  Atached is the sub-report.  In the footer is the row name and the totals.
PSSalesForecast-BU-V1.rpt
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 1000 total points
ID: 37067779
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
 
LVL 101

Expert Comment

by:mlmcc
ID: 37205960
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question