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!

Record Sorting 1

Status
Not open for further replies.

JStrittmatter

Technical User
Apr 4, 2002
21
0
0
US
I want to be able to select every record if the number of records is < 50 and then select every other record if the record number is < 100 so I can print mailing labels.
 
Dear Jstrittmatter,

What do you mean select? Do you mean that if only 50 records are returned to **show** them all, but if 100 records are returned to **suppress** every other one?

Your question does not contain enough information to formulate an answer.

Version of Crystal
Database
The point of what you are trying to do (the "so I can print mailing labels" is not enough info).

Regards,
ro

Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Use the following to conditionally suppress the records.

whileprintingrecords;
if count({one_of_your_fields})<50 then false else
if count({one_of_your_fields})<100 then
if remainder(recordnumber,2)=0 then true

Mike
 
I am using CR 9
SQL Database

We are sending out surveys for services the we provide. Some services have more consumers than others and we want to be able to pick out just a sampling of these people. We need mailing labels for the people we are sending these surveys to. I hope this is a little bit more helpful
 
Dear Jstrittmatter,

Now it is clearer.

MBarrons suggestion is what you will want to go with, with just a little change.

Since we have no idea how your report is laid out, I have to assume that you have mailing addresses in the detail section with a detail for each label.

Go to Format/Section/Click on Details and then click the x-2 formula editor box next to suppress (do not check suppress).

Enter the following formula:

If count({Table.PrimaryKey}) <= 50
then false
else
If remainder(recordnumber,2) = 0
then true
else false

The above should work. You must change the {Table.PrimaryKey} to a field on your report that is never null, like a primary key.

Regards,
ro




Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Now they have changed everything on me. They want to go by percentage of the number consumers. The break down is as follows:

> 30 print them all
between 30 and 100 print 25%
< 100 print 10%

Any help you can give me would be wonderful.
 
Dear JTStittmatter,

You continue to confuse me :)

> 30 and between 30 and 100 and < 100 **glop** all over each other and really are not good for devising logic ... it seems that maybe the > and < symbols are confused in places ...

If you meant: if there are 30 or less, print all and if there are between 31 and 100, then print 25% and if there are greater then 100 records then print 10% of the records, then the following should do....

Code:
numbervar cnt :=

(Select count({Incident.Incident #})
case 0 to 30 :   1  //always prints
case 31 to 100 : 4  //25%
default : 10        //10%
))
;

remainder(recordnumber,cnt) <> 0

Hope that helps,

p.s. In my formula above, since I am using CR 8.5 there are two parens just before the ";", I know that the Crystal bug that required this was fixed in CR10, but I do not know if the bug was fixed in CR 9 as I don't have that version. If you receive an error on the extra paren then just delete one close paren.

The open and close (& in CR8.5 the double close) are required because I have a case statement in the statement setting the value for the variable and otherwise it does not think that the statement separator ";" is valid.

ro

Rosemary Lieberman
rosemary-at-microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.

You will get answers more quickly if you read this before posting: faq149-3762
 
Rosemary

You are wonderful. I did screw up the signs thanks a million for your help on this it works like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top