About group filters PLSQL

2-40 Oracle Reports Users Guide to Building Reports ■ Formulas are calculated such that any column referenced in the formula will be calculated first. To do so, Oracle Reports Builder builds a dependency list, to guarantee proper ordering of calculations. Note that circular dependencies, in which a column references another column which in turn references the first column, either directly or indirectly, are not allowed. ■ When using SRW.DO_SQL, we recommend that you do not read database values that are updated or inserted in the same report. There is no guarantee of the exact time Oracle Reports Builder will fetch records from the database for formatting the output. Oracle Reports Builder does internal data look-ahead to optimize performance. Thus, a particular record might already have been accessed before an update is issued to the same record. Oracle Reports Builder builds internal dependency lists which guarantee that events, such as invocation of user exits, calculation of summaries, and so on, happen in the correct order. However, Oracle Reports Builder cannot guarantee these events will be synchronized with its internal data access or with the formatting of data. Examples Example 1: Adding values The following example populates the column with the value of the salary plus the commission. function salcomm return NUMBER is begin return:sal + :comm; end; Example 2: Using conditions The following code adds the commission to the salary if the value for the commission is not null. function calcomm return NUMBER is temp number; begin if :comm IS NOT NULL then temp := :sal + :comm; else temp := :sal; end if; return temp; end; See also Section 2.3.2, About formula columns Section 4.13.4.3, Creating or editing a formula column Section 4.13.4.4, Creating a placeholder column

2.6.9 About group filters

A group filter determines which records to include in a group. You can use the packaged filters, First and Last, to display the first n or last n records for the group, or you can create your own filters using PLSQL. You can access group filters from the Object Navigator, the Property Inspector the PLSQL Filter property, or the PLSQL Editor. Advanced Concepts 2-41 The function must return a boolean value TRUE or FALSE. Depending on whether the function returns TRUE or FALSE, the current record is included or excluded from the report. Difference between group filters and Maximum Rows to Fetch property The Maximum Rows to Fetch property restricts the actual number of records fetched by the query. A group filter determines which records to include or exclude, after all the records have been fetched by the query. Since Maximum Rows to Fetch actually restricts the amount of data retrieved, it is faster than a group filter in most cases. If you set the Filter Type property to Last or Conditional, Oracle Reports Builder must retrieve all of the records in the group before applying the filter. Also, you should be aware that when using Maximum Rows to Fetch for queries, it can affect summaries in other groups that depend on this query. For example, if you set the Maximum Rows to Fetch property to 8, any summaries based on that query will only use the 8 records retrieved. Restrictions ■ Group filters cannot be added to groups if the Filter Type property is set to First or Last. Group filters cannot be added to cross-product groups. ■ The function that you enter for a group filter can only depend upon the following columns: ■ a database column owned by the groups query or a query above it in the data model hierarchy ■ computed columns formulas or summaries that depend on unrelated queries that is, computed columns that do not depend upon columns in the group, the groups ancestors, or the groups descendants ■ In a group filter, you can read the values of Oracle Reports Builder columns and parameters of the correct frequency, but you cannot directly set their values. For example, you can use the value of a parameter called COUNT1 in a condition for example, IF :COUNT1 = 10, but you cannot directly set its value in an assignment statement for example, :COUNT1:= 10. Note also that the use of PLSQL global variables to indirectly set the values of columns or parameters is not supported. If you do this, you may get unpredictable results. You also cannot reference any page-dependent columns that is, Reset At of Page or columns that rely on page-dependent columns in a group filter. Example function filter_comm return boolean is begin if :comm IS NOT NULL then if :comm 100 then return FALSE; else return TRUE; end if; else return FALSE; -- for rows with NULL commissions end if; end; 2-42 Oracle Reports Users Guide to Building Reports See also Section 4.13.4.2, Creating or editing a group filter

2.6.10 About REF CURSOR queries