Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interesting Function

Status
Not open for further replies.

sparky2708

Programmer
Jul 8, 2002
18
US
I was thinking of a clever way of doing this but can't seem to cme up with a way. So suppose you have a crosstab in Crystal Reports and you want some field in that crosstab that is running down the page to alternate in color. Say you want every other row to have some color like green. How would you do this if the database has no number you can use to tell you what color something should be? I tried mod but I can figure out how to count to see which row I am on. Maybe attach the SQL count aggregation operator... Any ideas? This is not ADO - just a regular query - nothing fancy.
 
I have never tried this with a crosstab, but of you conditionally set the background color of each summarized field in the crosstab with the following formula, you should get an alternating background color.

if groupnumber/2 = int(groupnumber/2) then silver Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
Dgillz,
I think you are describing my mod trick. Basically take the Row number mod 2 which either returns 1 or 0 and then set the color depending on whether you get 1 or 0. The problem is: how do I get the row number? Is there a command in Crystal Reports that will tell you how many rows you have retrieved so far?
 
Sparky,

There is a command recordnumber which is nothing more than a counter. However this command has very little meaning in a cross tab report. This is why I said use groupnumber instead.

However upon further research, groupnumber is not the number of groups returned by the report, rather the nuimber of groups defined by the report. In my test case Ihad one group, so groupnumber ia ALWAYS equal to 1.

I have played with this for about 30 minutes and I do not believe it is possible with CR v8.5. Anyone with CR v9 want to step up to the plate on this? Software Training and Support for Macola, Crystal Reports and Goldmine
251-621-8972
dgilsdorf@mchsi.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top