# Formulas and Custom Variables

**Introduction**

A formula is used to display information that is not retrieved by existing objects in the universe. The formula is the definition of how to produce that information.

Formulas can be static, meaning that the output of your formula does not change. Or, they can be dynamic, meaning that the output of your formula changes based on other elements in your report, such as objects, prompts, other rows and so forth.

Formulas can be used to achieve the following:

- Cosmetic preferences, such as concatenating two text fields together into one field
- Math, including number crunching and aggregating functions (e.g. maximums, minimums, counts, totals)
- Altering existing data, such as renaming fields, Date & Time conversions and Character functions (e.g. length and position)
- Unique sorting and grouping of data
- Metadata, which is data about your data, such as Document information (e.g. author, run date) and Logic functions (e.g. is this condition true?)
- Conditional statements, such as "If/Then" statements, which can apply all of the above only when certain conditions are met

The following functions in InfoView use formulas:

- Function Rows (pre-set)
- Pre-defined Cells (pre-set)
- Formula Bar (user defined)
- Custom Variables (user defined)

Note: See the section "See Also" for a few other related functions.

**Section 1: Looking at Formulas**

To start out, let's just view some formulas that are already pre-defined inside InfoView.

**Read or Watch:**

**Exercises**

1. Create a report in a universe that you are comfortable with. Or, open a report and change into Design Mode.

2. Add a Function Row and a Pre-defined Cell to your report. Look at the contents of those cells in your Formula Bar: what you see are formulas.

**Section 2: Essentials**

You will need an undersatnding of formula components in order to define formulas yourslef.

**Read or Watch:**

**Exercises**

1. Create several variables in a universe that you are comfortable with. Make varaibles using text, If-Then statements, Boolean Operators and parentheses.

**Section 3: Extras**

These sections are not required for understanding how formulas work. Instead, they list and explain popular options for formula components including functions, operators and advanced topics like contexts.

**Read or Watch: **

- Lists and explanations of popular functions

- List and explanation of popular Operators
- Syntax Help
- Very Advanced Formula Training

**Exercises**

1. Make variables using a variety of different functions. Did they do what you expected them to?

2. Complete the same action but with different variable operators.

3. For a function that you have tried already, go look at the SAP syntax guide. Try this guide for a function that you are unfamiliar with.

4. If you are feeling adventurous, try making a variable with a context in a report with a small amount of data. Make sure to validate your data: Did it work like you wanted it to?

**See Also**

These functions are related to variables and formulas:

- Grouping: Categorize the values in a column.
- Conditional Formatting: Change the formatting of your report based on a formula rule.
- InfoView Formula Reference and Training Document: Complete guide to formulas.