Flylib.com

Books Software

 
 
 

Math Functions

book list add book to my bookshelf create a bookmark purchase this book online

mastering crystal reports 9
Appendix E - Crystal Reports Built-in Functions
Mastering Crystal Reports 9
by Cate McCoy and Gord Maric  
Sybex 2003

Math Functions

The built-in math functions for Basic Syntax and Crystal Syntax allow some fairly sophisticated mathematic calculations. Use these functions in formula fields, conditional statements, and in other functions.

Abs(x) Returns a positive value for x.

Atn (number) Returns the angle whose tangent is the argument to the function.

Cos (number) Returns the cosine of an angle that was specified in radians.

Exp (number) Returns e (approximately 2.718282) raised to a power.

Fix (number), Fix (number, #places) Returns a truncated value.

Log (number) Returns a natural logarithm.

Pi Returns 3.14159265…

Remainder (number1, number2) Returns an integer that is left over after number1 is divided by number2 . The following Basic Syntax function can be used to control formatting in the Details section and set each even record number background to green and each odd number background to white:

If Remainder(recordNumber, 2) = 0 Then crGreen Else crWhite End If

Rnd, Rnd (seed) Returns a random number optionally based on a starting seed value.

Round (x), Round (x, #places) Returns a number rounded down to the nearest integer.

Sin (number) Returns the sine of an angle that was specified in radians.

Sqr (number) Returns the square root of a number.

Tan (number) Returns the tangent of an angle that was specified in radians.

Truncate (x), Truncate (x, #places) Returns a truncated value.

Use of content on this site is expressly subject to the restrictions set forth in the Membership Agreement
 
C o n e ll o 2000-2003  -  Feedback
book list add book to my bookshelf create a bookmark purchase this book online

mastering crystal reports 9
Appendix E - Crystal Reports Built-in Functions
Mastering Crystal Reports 9
by Cate McCoy and Gord Maric  
Sybex 2003

{% if main.adsdop %}{% include 'adsenceinline.tpl' %}{% endif %}

Summary Functions

The arguments to summary functions are fields from the report or the data source. These functions gather statistics and summarize data values. Some functions allow an array of values to be passed to a summarization function. These functions are often used with groups.

Average({table.field}) Returns the average for the given field value for however many records were processed in the Details section. This function can also accept the name of an array in place of the {table.field} argument.

Correlation Returns a number that represents how well the variation of one value can be predicted from the variation of another.

Count Returns the number of occurrences of a field. This function can also accept the name of an array in place of the {table.field} argument.

Covariance Returns a number that represents the tendency of two variables to move in tandem to one another.

DistinctCount Returns the number of unique occurrences of a value in a field. This function can also accept the name of an array in place of the {table.field} argument.

Maximum Returns the maximum value in a set of values (e.g., all the records for a given field). This function can also accept the name of an array in place of the {table.field} argument.

Median Returns the middle number in a set of values by dividing numerically ordered data into two equal parts .

Minimum Returns the minimum value in a set of values (e.g., all the records for a given field). This function can also accept the name of an array in place of the {table.field} argument.

Mode Returns the data value that occurred the most often in the set of values.

NthLargest Where N is any positive integer, returns the N largest data values.

NthMostFrequent Where N is any positive integer, returns the N most frequently occurring data value.

NthSmallest Where N is any positive integer, returns the N smallest data values.

PercentOfAverage Returns the average of values in a group relative to the percentage of all values.

PercentOfCount Returns the count of values in a group relative to the count of all values.

PercentOfDistinctCount Returns the count of distinct values in a group relative to the count of all distinct values.

PercentOfMaximum Returns the maximum of values in a group relative to the maximum of all values.

PercentOfMinimum Returns the minimum of values in a group relative to the minimum of all values.

PercentOfSum Returns the sum of values in a group relative to the sum of all values.

Population Variance Returns a number representing the dispersion in the values of a given population of data.

PopulationStdDev This function can also accept the name of an array in place of the {table.field} argument.

PthPercentile Returns the value associated with the specified percentile for the given field.

StdDev Standard deviation measures the spread of a distribution about the mean in a set of data values. This function can also accept the name of an array in place of the {table.field} argument.

Sum Adds the values in a field or set of values. This function can also accept the name of an array in place of the {table.field} argument.

Variance Returns a number measuring the amount of change between values in a set of data. This function can also accept the name of an array in place of the {table.field} argument.

WeightedAverage Returns an average that accounts for a dependent variable.

Use of content on this site is expressly subject to the restrictions set forth in the Membership Agreement
 
C o n e ll o 2000-2003  -  Feedback