Reporting 9 reportdesignerformulaexpressions 220212 0940 25814

4
1. 2. 3. 4. 5. 6. 7. 9. Report Designer Formula Expressions Using the Formula Editor : The Report Designer interface has changed, and the documentation has been updated to reflect that. Important The Formula Editor allows you to associate a formula with a text field, date field, number field, and so on. Formulas allow you to define relationships between columns in your report. While they play an important role, formulas can be difficult to create. The Formula Editor makes the process of creating a formula easy and efficient; it also validates the formula thereby minimizing errors. : You cannot add a formula through the Properties pane when a field is selected. You must create the formula first, Warning then associate it with a field. Follow the instructions below to create a formula: In the Design panel, select a field to which you want to associate a formula. Click in the upper right panel. Report Functions Click in the Properties panel. Add Function to Report Select the newly created function. In the panel, click to open the . Properties Set Properties Formula Editor In the Formula Editor dialog box, select a from the list. The list is populated with the functions that are most Category Function appropriate for the category you selected. Select the appropriate function. When you select a function, the Report Editor displays the formula expression (the equation and relevant parameters); it also displays the and as shown in the example below: Return Type Description You can enter a formula expression directly into the editable text box under ; however, it may easier to enter the values in the appropriate Formula text boxes in the panel. The formula expression updates automatically as you enter values. You can select and insert a data field Parameters

description

 

Transcript of Reporting 9 reportdesignerformulaexpressions 220212 0940 25814

Page 1: Reporting 9 reportdesignerformulaexpressions 220212 0940 25814

1. 2. 3. 4. 5. 6.

7.

9. Report Designer Formula Expressions

Using the Formula Editor

: The Report Designer interface has changed, and the documentation has been updated to reflect that.Important

The Formula Editor allows you to associate a formula with a text field, date field, number field, and so on. Formulas allow you to definerelationships between columns in your report. While they play an important role, formulas can be difficult to create. The Formula Editor makes theprocess of creating a formula easy and efficient; it also validates the formula thereby minimizing errors.

: You cannot add a formula through the Properties pane when a field is selected. You must create the formula first,Warningthen associate it with a field.

Follow the instructions below to create a formula:

In the Design panel, select a field to which you want to associate a formula.Click in the upper right panel.Report FunctionsClick in the Properties panel.Add Function to ReportSelect the newly created function.In the panel, click to open the .Properties Set Properties Formula EditorIn the Formula Editor dialog box, select a from the list.  The list is populated with the functions that are mostCategory Functionappropriate for the category you selected.Select the appropriate function. When you select a function, the Report Editor displays the formula expression (the equation and relevantparameters); it also displays the and as shown in the example below:Return Type Description 

 You can enter a formula expression directly into the editable text box under ; however, it may easier to enter the values in the appropriateFormulatext boxes in the panel.  The formula expression updates automatically as you enter values. You can select and insert a data fieldParameters

Page 2: Reporting 9 reportdesignerformulaexpressions 220212 0940 25814

(from your data source) into your formula expression. You are not required to know the syntax or remember the names of available fields. Clickthe icons next to text boxes in the panel to display existing report fields.Parameters

Formula Syntax Description

Formulas start with a "=" or a formula prefix (any letter and number followed by a colon; the prefix is not interpreted yet, but is used later toseparate different formula-namespaces. Therefore, the following formulas are equivalent:

=1

report:1

References to external data-fields are expressed using square brackets.

=[yourfield]

If a field's name contains special characters, first surround it with double quotes:

=[ ]"[Reseller].[Reseller.Reseller].[All Resellers].[Azabujuban]"

Possible operators are:

Basic computation: +, -, *, /Percentage: %Power: ^String-concatenation: &Comparisons: =, <>, <, <=, >, >=Formulas can have braces.

Example:

=(1+1)*2 / 3

results in 1.3333333

=10%

results in 0.1

String-constants are expressed using double-quotes.

="Your text here"

Strings can be concatenated using the & operator.

= & "Your text here " "some more text"

The Range-Operators known from Spreadsheet applications are not supported, as they have no meaning in the reporting. A formula can onlywork on the current values of the current datarow. There is no way to access previous or next rows of data. (These are the same limitations aswith all expressions, so this is nothing new.)

Date/Time Functions

DATE - Provides an internal number for the given date. - Returns the number of years, months, or days between two dates.DATEDIF

- Returns the current time.TIME - Returns date serial number from given text.DATEVALUE

- Return the serial number of the current date and time. This returns the current day and time serial number, using the * current locale.NOW

Page 3: Reporting 9 reportdesignerformulaexpressions 220212 0940 25814

- Returns the current date, (yyyy-mm-dd).TODAY - Returns the day of the month for a date (1 through 31)DAY

- Returns the month of a dateMONTH - Returns the year of a dateYEAR

- Returns the day of week from a date.WEEKDAY - Returns the hour (0 through 23) from a time.HOUR

Logical functions

AND - Returns TRUE if all arguments are TRUE. - Defines the logical value as FALSE.[FALSE]

- Specifies a logical test to be performed.IF - Reverses the value of an argument.[NOT]

- Returns TRUE if an arguments are TRUE.OR - Defines the logical value as TRUE.TRUE

- Returns a value of TRUE only if just one of its operands is TRUE. In contrast, an inclusive OR operator returns a value of TRUE if either orXORboth of its operands are TRUE.

Rounding functions

INT - Returns a number down to the nearest integer

Mathematical functions

SUM - Sum a list of numeric values. - Returns the absolute (nonnegative) of the value.ABS

- Average a list of numeric values.AVERAGE - Returns the rounding a number up to the nearest odd integer.ODD - Returns the rounding a number up to the nearest even integer.EVEN - Returns the remainder when one number is divided by another number.[MOD]

- Returns the maximum from a set of numbers.MAX - Returns the minimum from a set of numbers.[MIN]

Text functions

[LEN] - Returns the lengh in characters of the given value. - Returns the given text in lower case.[LOWER] - Returns the given text in upper case.[UPPER]

- Returns the given text free of leading and trailing spaces. Internal multiple spaces are replaced by one.TRIM - Returns the given value as text.TEXT

- Returns the given text value or a zero lenght string for non text type.T - Returns the starting position of a given text.FIND

- Reports if two text values are exactly equal using a case-sensitive comparison.EXACT - Returns text repeated Count times..REPT

- Returns extracted text, given an original text, starting position, and length.MID - Returns a selected number of text characters from the left.LEFT

- Returns a selected number of text characters from the right.[RIGHT] - Applies URL-Encoding to a text given in the first parameter \URLENCODE

  using the encoding specified in the second parameter. If no encoding is \  given, ISO-8859-1 is assumed.

- Returns text where an old text is substituted with a new text within the start index and length range.REPLACE - Returns text where an old text is substituted with a new text. If which is specified, only this occurrance will be replaced otherwiseSUBSTITUTE

every occurrance will be replaced.

Information functions

HASCHANGED - Checks, whether the columns specified by the given names has changed. - Checks, whether the value is undefined (null).ISBLANK

- Returns the constant error NA.[NA] - Tells if the parameter is of error type NA.[ISNA]

- Checks whatever the value is of type Logical.ISLOGICAL - Checks whatever the value is of type Text.[ISTEXT]

- Tells if the parameter is of error type but returns false if the error is of type NA.ISERR - Tells if the parameter is of error type but returns false.[ISERROR]

- Uses an index to return a value from a list of values.CHOOSE - Checks whatever the value is a reference.ISREF

- Checks whatever the value is of type Number.[ISNUMBER] - Checks whatever the value is an odd number.[ISODD]

Page 4: Reporting 9 reportdesignerformulaexpressions 220212 0940 25814

- Checks whatever the value is an even number.[ISEVEN] - Checks whatever the value is not of type Text.[ISNONTEXT]

Userdefined - Returns a NULL-ValueNULL

Formula Operators

+ Add- Subtract* Multiply/ Divide= Equal<> Not Equal< Less Than> Greater Than<= Equal Less Than>= Equal Greater Than& Concatenate^ Power

Prefix/Suffix Operators

% Percent (Suffix)+ Positive (Prefix)- Negative (Prefix)

Note: The formula syntax used in LibFormula is based on the OpenFormula standard. Download the complete documentationfrom Oasis: OASIS OpenFormula Specifcation