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

Percentage help 1

Status
Not open for further replies.

dsea

Technical User
Jul 15, 2004
2
US
I was able to find percentageofcount in the crystal database, unfortunately it doesn't work for me. I was wondering if someone could post an example of how it works.

Dsea
 
You're probably better served posting what you need, rather than asking people to elaborate on the help file.

Try posting the following:

Crystal version
Database used
Example data
Expected output

Here's the help file description:

PercentOfCount
Basic and Crystal syntax.

Overloads
PercentOfCount (fld, condFld)
PercentOfCount (fld, condFld, cond)
PercentOfCount (fld, innerCondFld, outerCondFld)
PercentOfCount (fld, innerCondFld, innerCond, outerCondFld)
PercentOfCount (fld, innerCondFld, outerCondFld, outerCond)
PercentOfCount (fld, innerCondFld, innerCond, outerCondFld, outerCond)
Arguments
fld is a Number, Currency, String, Boolean, Date, Time or DateTime field that can be evaluated by the function.
condFld is a field used to group the values in fld by.
cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
innerCondFld is a field used to group the values in fld by.
innerCond is a String indicating the type of grouping for innerCondFld. You only specify this argument when innerCondFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
outerCondFld is a field used to group the values in fld by.
outerCond is a String indicating the type of grouping for outerCondFld. You only specify this argument when outerCondFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns
Number value.

Action
PercentOfCount (fld, condFld) has the same effect as: 100 * Count (fld, condFld) / Count (fld). It expresses the count of the values of the field fld for the group determined by condFld as a percentage of the count of all the values of fld.

PercentOfCount (fld, condFld, cond) has the same effect as: 100 * Count (fld, condFld, cond) / Count (fld). The String argument cond expresses some additional information to precisely specify the grouping. For example, if condFld is a Date field, is the grouping "daily" or "weekly" or "monthly" etc.

PercentOfCount (fld, innerCondFld, outerCondFld) has the same effect as: 100 * Count (fld, innerCondFld) / Count (fld, outerCondFld). It expresses the count of the values of the field fld for the group determined by innerCondFld as a percentage of the count for the group determined by outerCondFld.

PercentOfCount (fld, innerCondFld, innerCond, outerCondFld) has the same effect as: 100 * Count (fld, innerCondFld, innerCond) / Count (fld, outerCondFld).

PercentOfCount (fld, innerCondFld, outerCondFld, outerCond) has the same effect as: 100 * Count (fld, innerCondFld) / Count (fld, outerCondFld, outerCond).

PercentOfCount (fld, innerCondFld, innerCond, outerCondFld, outerCond) has the same effect as: 100 * Count (fld, innerCondFld, innerCond) / Count (fld, outerCondFld, outerCond).

Examples
The following examples are applicable to both Basic and Crystal syntax:

PercentOfCount ({Orders.Order ID}, {Orders.Order Date}, "annually")

Returns the total number of orders that were ordered in a given year expressed as a percent of the total number of all orders.

PercentOfCount ({Orders.Order ID}, {Orders.Ship Via})

Returns the total number of orders shipped via a given shipping company expressed as a percent of the total number of all orders.

PercentOfCount ({Product.Product ID}, {Product.Size}, {Product.Product Class})

Returns the total number of products of a given size and class expressed as a percent of the total number of products of the same given class.

Comment
This function and other percentage functions are intended to support Percentage Summary fields. The groupings supplied as arguments must actually exist in the report for the summary function call to succeed.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top