# Oracle Business Intelligence Beans Sample

## Creating Calculations

### Overview

The Creating Calculations sample application demonstrates how to use CalcBuilder to modify a Crosstab.

The `BICalc` class extends `BIFrame`. The `BICalc` class provides a menu with access to a simple connection dialog which prompts a user for security credentials. `BICalc` then makes the two connections described above. After the connections are established, a new crosstab can be created using the New Crosstab option on the File menu.

After a Crosstab is created, the user can perform one of the following functions:

- Insert a custom calculation by invoking CalcBuilder. The user can invoke CalcBuilder by using the Insert Calculation menu item or by clicking the toolbar button.

- Insert a predefined calculation. The user can right-click any measure or data cell of the Crosstab, and a menu will appear, enabling the user to insert a measure that lags the selected measure by one year.

### Code Highlights

There are three significant areas in the code, which comprise most of the features of the BICalc sample. The two methods

`protected void runCalcBuilder()`

and

`private void insertYearAgo(MDMeasure measure)`

show how to use CalcBuilder to generate a custom measure and how to manually create a custom measure, respectively. Once the measure has been obtained, both methods use

`private void updateMeasures(MDMeasure mdMeasure)`

to include it in the query.

Copyright © 2004 Oracle Corporation. All Rights Reserved.