Ægir Örn Sveinsson
asked on
Alternating colors - Want the first color of the detail band within a group to be always the same
I have a formula like this:
If RecordNumber Mod 2 = 0 Then Color (236,236,236) else crNoColor
What I get with this is that it is random whether the first color within the group is grey or white.
How can I change it so that the first line is always grey?
If RecordNumber Mod 2 = 0 Then Color (236,236,236) else crNoColor
What I get with this is that it is random whether the first color within the group is grey or white.
How can I change it so that the first line is always grey?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. I am a beginner in this so I would like to ask: What is the purpose with the statement "WhilePrintingRecords;"?
This seems to be working, even though it is not there.
This seems to be working, even though it is not there.
WhilePrintingRecords tells the report engine when to evaluate the formula.
The Printing Records pass is the last pass through the report.
Shared variables are intended to be used for sharing information between a main report and a subreport. By definition they are evaluated in the Printing records pass so the directive is not needed. I usually add it to document when the formula will be evaluated.
Since my formulas use GLOBAL variables rather than SHARED the directive is needed. If it not included then the engine determines when to do the evaluation which may be the wrong time in the report evaluation process.
For more information see this article from Crystal, It is a bit dated but the process used is still the same.
Evaluation Times and the Multi-Pass Model
http://scn.sap.com/docs/DOC-21390
mlmcc
The Printing Records pass is the last pass through the report.
Shared variables are intended to be used for sharing information between a main report and a subreport. By definition they are evaluated in the Printing records pass so the directive is not needed. I usually add it to document when the formula will be evaluated.
Since my formulas use GLOBAL variables rather than SHARED the directive is needed. If it not included then the engine determines when to do the evaluation which may be the wrong time in the report evaluation process.
For more information see this article from Crystal, It is a bit dated but the process used is still the same.
Evaluation Times and the Multi-Pass Model
http://scn.sap.com/docs/DOC-21390
mlmcc
Shared NumberVar GroupNum;
GroupNum := GroupNum + 1;
if Remainder(GroupNum, 2) = 0 then crNoColor
else Color(236,236,236)