Crystal Report formula must be read

Source: Internet
Author: User

Directory:
I. formula components
Ii. Formula syntax
Iii. Formula type
----------------------------------------------------------------
The formula consists of two key parts: component and syntax. A component is the part added to the creation formula, and the syntax is the rule followed by the Organization component.
There are several different types of formulas in Crystal Reports: Reports, formatting, selection, search, running total conditions, and alarm formulas. Most formulas in a report are report formulas and Conditional Formatting formulas.
----------------------------------------------------------------
I. formula components
Creating formulas in Crystal Reports is similar to creating formulas in any spreadsheet application. You can use the following components in the formula:

Field
Example: {customer. Customer name} and {customer. sales last year}

Number
Example: 1, 2, 3.1416

Text
Example: "quantity", ":", and "your text"

Operator
Example: + (plus),/(except),-X (negative)

Operators are operations that can be used in formulas.

Function
Example: round (x), trim (X)

Calculate the average, sum, and count of function execution. Lists all available functions, including their parameters, and lists them by purpose.

Custom Functions
Example: cdfirstdayofmonth, cdstatutoryholidays

Custom functions provide a way to share and reuse the formula logic. They can be stored in the crystal repository and then added to the report. After a user-defined function is added to a report, you can use the User-Defined Function in "formula experts" when creating a formula.

Control Structure
Example: "if", "select", and "for" Loops

Group Field Value
Example: Average (condition, condlimit), sum (condition, condlimit, "condition ")

The group field values are summarized. For example, you can use the group field value to obtain the percentage of each group in the total.

Other formulas
Example: {@ grossprofit} and {@ quota}

For more information, see formula syntax.
----------------------------------------------------------------
Ii. Formula syntax
Syntax rules are used to create the correct formula. Some basic rules are as follows:

Enclose text strings in quotation marks.
Enclose the parameters in brackets (at the proper position ).
The referenced formula is identified by the leading @ symbol.
Crystal syntax and basic syntax
When creating a formula, you can choose to use the crystal or basic syntax. Almost any formula written using a certain syntax can be written using another syntax. A report can contain formulas using the crystal syntax or the formulas using the basic syntax.

The crystal syntax is included in all versions of Crystal Reports.

If you are familiar with Microsoft Visual Basic or other basic versions, you may be more familiar with basic syntax. All in all, in addition to specific extensions to process reports, the basic syntax uses Visual Basic as the model.

If you are used to the crystal syntax, you can continue to use it and benefit from the new functions, operators, and control structures generated by Visual Basic.

Note:

The formulas for record selection and group selection cannot be written in basic syntax.
Using basic syntax does not slow down the report processing process. Reports using basic syntax formulas can be run on any machine running Crystal Reports.
Using the basic syntax formula, you do not need to distribute any additional files together with the report.
Related Topics
For more information about basic syntax, see create formulas using basic syntax.

For more information about Crystal syntax, see use crystal syntax to create formulas.
----------------------------------------------------------------
Iii. Formula type
There are several different types of formulas in Crystal Reports: Reports, formatting, selection, search, running total conditions, and alarm formulas. Most formulas in a report are report formulas and Conditional Formatting formulas.

Report Formula
A report formula is a separate formula created in a report. For example, the formula for calculating the number of days between the order date and the delivery date is the report formula.

Conditional Formatting Formula
Format the formula to change the layout and design of the report, as well as the appearance of text, database fields, objects, or the entire report section. Use the "format Editor" to set the text format. To create a formatting formula, access the formula studio from the format editor. See use conditional formatting.

Selected Formula
Select the records and groups specified by the formula and restrict the records and groups that appear in the report. You can enter these formulas directly, or you can use "select experts" to specify the selected content. Crystal Reports then generates the record selection and group selection formulas. You can manually edit these formulas, but you must use the crystal syntax. See select record.

Search Formula
Search formulas help you locate data in reports. Similar to the selected formula, you do not need to enter these formulas directly, but use "search experts" to specify the search criteria. Crystal Reports generates this formula. You can manually edit these formulas, but you must use the crystal syntax.

Note: If you already know basic syntax, you only need to know a few crystal syntaxes to modify most of the selected formulas and search formulas.

Formula for running total Conditions
The run total condition formula enables you to define the conditions on which the run total is evaluated or reset. See create condition run total.

Alarm Formula
Alarm formulas help you define conditions and messages for report alarms. See about report alarms.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.