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

HELP :) Counting group records for changing color of sections properly

Status
Not open for further replies.

dafi

Programmer
Apr 19, 2001
25
0
0
RO
I have 2 sections with 2 different background colors (actually I drew 2 boxes with different colors) so it like the same thing ...)
I grouped the information and now the problem is:
there are odd number of records for each group and my "formula" for surpressing the section that I don't want to be shown becouse of the improper color changes the swithes the 2 colors on new group.

Ex: White Black White for 1st group
B W B for the 2nd group
W B W for the 3rd group and so on
I need W B W
W B W

the &quot;formula&quot; is reminder(recordnumber,2) = 0 for first section and <>0 for 2nd section
so, i need an information about the current group counter of the records.
Since i don't have a proper manual is it difficil to know the build in functions and counters used by CrystalReports
 
Dear Dafi,

If I understand you correctly, because you wanted grey bar look to the report, you created 2 detail section, insert different colored box into each section and your suppression is based upon record number so that you get a greybar look.

Easier then the two section method is to use 1 section, in the Format Section tab, Click Color Tab, Background Formula editor and insert your formula:

if Remainder(recordnumber,2)= 0 then CrSilver else CrWhite

Note, you can also do the same to color the backgroud of a group by replacing recordnumber with groupnumber.

Now if I understand your exact issue, is that as each group starts you want it to &quot;reset&quot; to start with a white bar, regardless of what color bar it ended on!

This is simple. Create a Running Total ({#RTotal0}) that counts the number of records in a group (a field that appears on every line), reset on change of group.

Now change your formula to:

if Remainder({#RTotal0},2)= 0 then CrSilver else CrWhite

Now the details in each group are W B W (I used silver - but you get the picture)

Hope this helps,

ro Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
some explainig first.
Since I didn't know how to change the background color of a box - i think it's a readonly attribute, I tried to do the trick with the backcolor ...
pretty cool, but my information takes 1/2 of the page, centered, so it was necessary to add some boxes on left/right that are white ... oohhhhh ... (I don't want to mension the &quot;left bar&quot; which crosses all the report)
very ugly.
So I surfed a little and I've found a method with 2 section, a method that is pretty simple and classy (I think so)

The background of the box changes on every record in every group so it alternates on the report on every page (I used new page after group)

probably your solution will work, I haven't tried it yet.
 
Well ,it worked, thank you !!!
I created the counter, reset after group and is super cool !
 
Dear Dafi,

You are correct in that you cannot conditionally set the attributes of a box.

You can still use your boxes, just change the suppression formula as I indicated by basing it on the Running Total Count of Records which resets for each group.

So, instead of remainder(recordnumber,2) = 0 it will be
Remainder({#RTotal0},2)= 0 and then for the second section:

Remainder({#RTotal0},2) <> 0

Hope this helps,

ro Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Dafi,

We must have been posting at the same time :)

Glad it worked for you, happy to help.

ro Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top