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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

? Set multiple report colors from CR Formula (const value)

Status
Not open for further replies.

MVisconte

Programmer
Jun 17, 2002
105
US
While researching something else CR on the web the other day, I ran across a mention of setting a color "constant" in a user formula (with other report constants). The idea was, you could define several constants in one formula and just copy/insert that formula from report to report. From w/in Format Section, Background Color, you were supposed to be able to reference the "constant" somehow.

I don't remember where I saw the article or the details. I have tried several ways to do it, but nothing is clicking for me using arrays or setting a variable to COLOR( x, y, z).

Does this ring a bell w/ anyone?

I could probably do it by defining separate Red, Blue, Green values and referencing them as COLOR( RVal, BVal, GVal), but I don't think that's the way the article defined it... and it would make having several COLORs define pretty awkward... i.e., for a report header, a detail header, a section header:
RValRptHeader, BValRptHeader, GValRptHeader,
RValDtlHeader, BValDtlHeader, GValDtlHeader,
RValStnHeader, BValStnHeader, GValStnHeader...

See what I mean?

Anybody?

If I'm not clear, then yell and I'll try to explain better.

--
Marc Visconte
CSC
Lead RMS Developer
Crystal Reports
 
I guess I don't understand the value of this as I would design the standard report colorized and including whatever artwork you need in both portrait and landscape, and then save them as generic PT and Generic LD.

You could place a formula or formulas with variables in them using the RGB(<variable1>,<variable2>,<variable3>) to define colors, and then referecne them in other reports, but it seems more labor intensive to me.

-k
 
I think the key thing is to be able to "define" a color, and treat it like a formula -- able to copy it from report to report, reference it w/out having to manually key it, etc.

I thought it was a neat idea, but one that I'd never really NEED. Then we started new reports, and all of the finely tuned background colors had to be fished out manually.

The vast majority of our reports are breath-takingly similar (humor). When we do new report, I will use an old report as a basis, if possible, but sometimes the designs are too far apart and it's easier to start afresh rather than deconstruct the template and build the way it needs to be. The road back is a long one.

So the bell went off in the back of my mind and I tried to find the article again... no joy.

If I can find it or figure out how they did it, I can come up w/ a common formula that gets copied into a new report, and then all backgrounds will be locked to the correct values instead of best-guessed at.

We're still on CR8, but I want to migrate to CR10. This seems like an excellent use of the repository -- no more needing to copy a passle of formulas or trying to deconstruct a complex report.

Sorry for the effuse verbiage, but I'm at home sick w bronchitis, and between the oxygen starvation dizzy-ness and the Codi-clear cough syrup woozies, my black-and-white is a very colorful world right now.

Being sick sucks. I would much rather be at work.


--
Marc Visconte
CSC
Lead RMS Developer
Crystal Reports
 
You could define a set of colors in an initialization formula that you place in the report header, and then reference it throughout the report. Then if you want to change colors, you only need to change it in the initialization formula:

whileprintingrecords;
numbervar color1 := color(200,100,50);
numbervar color2 := color(100,200,100);

Then to color a field, you would go to format->field->border->background->x+2 and enter:

whileprintingrecords;
numbervar color1;

Perhaps you've already thought of this though...

-LB
 
I thought I had tried it w/ scalars variables set to arrays... my attempt didn't work, but I am more than willing to experiment again with it.

I'm excited... can't wait to do the two-hour drive to the office to play. That's part of what's so much fun about this job... it's like free-time in the computer lab (college frame).

Thanks guys, I've got more things to try.

Marc

--
Marc Visconte
CSC
Lead RMS Developer
Crystal Reports
 
Ahhh, it makes more sense as a playtime activity ;)

Again, you can have standard colors already set for standard objects, so the value here sounds like higher maintenance to me, unless you are dynamically coloring fields from an external programming language, or some such.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top