Skip to Main Content
Return to Navigation

Setting Up Expressions

Expressions enable you to create virtual columns that are made up of mathematical calculations based on actual fields on a table. Because expressions are resolved at runtime, duplicate information is not stored in the database. Expressions are user-defined columns that you add to a datamap. After you add them as columns to the underlying datamap, you can use them in filters just like record fields. An expression can be either numeric or a string. Numeric expressions can combine any number of record fields, value objects, and math operators. String expressions can be concatenations of any number of character record fields and value objects.

Note: On DB2 UDB for OS/390 and z/OS, you should compose your expressions so that multiplication occurs before division; otherwise, decimal precision may be affected as values may be truncated. Use parentheses where necessary to control the order of calculation to ensure correct decimal precision.

This topic discusses how to define expressions.

Page Used to Set Up Expressions

Page Name

Definition Name

Navigation

Usage

Expression

PF_EXPR_DEFN

select EPM Foundation, then select Business Metadata, then select Constraint and Expressions, then select Expression

Define an expression.

Expression Page

Use the Expression page (PF_EXPR_DEFN) to define an expression.

Image: Expression page

This example illustrates the fields and controls on the Expression page. You can find definitions for the fields and controls later on this page.

Expression page

Note: It is important to consider how an expression will be used when you want to specify date-related value objects. If the expression is to be used in a WHERE clause, then the %CurrentDateIn value object must be used. If the expression is to be used in a SELECT clause, then the %CurrentDateOut value object must be used.

When you have completed your expression, click the Compile button to compile the expression.

SQL Functions That Are Available to the Expression Builder

The following table lists the SQL functions that are available to build expressions.

SQL Object ID

Expression Function

Return Value

Description

PF_FUNCLIB_DATE_DAYADD_UPD

AddtoDays (Date, Integer)

Date

Increase date by adding days (Integer).

PF_FUNCLIB_DATE_DAYDIFF_UPD

DiffDates (Date, Date)

Integer

Calculate difference between two dates.

PF_FUNCLIB_DATE_DAY_UPD

GetDay(Date)

Integer

Returns numeric day of the month from date.

PF_FUNCLIB_DATE_MONADD_UPD

AddtoMonth(Date, Integer)

Date

Increase date by adding months (Integer).

PF_FUNCLIB_DATE_MONBEG_UPD

BOM(Date)

Date

Returns the date value for the beginning of the month.

PF_FUNCLIB_DATE_MONTH_UPD

GetMonth(Date)

Integer

Returns numeric month from date.

PF_FUNCLIB_DATE_YEARBEG_UPD

BOY(Date)

Date

Returns date for the beginning of the year.

PF_FUNCLIB_DATE_YEAREND_UPD

EOY(Date)

Date

Returns date for the end of the year.

PF_FUNCLIB_DATE_YEAR_UPD

GetYear(Date)

Integer

Returns numeric year from date.

PF_FUNCLIB_DATE_YYMMDD_UPD

YYMMDD(Date)

Character

Formats date YYMMDD.

PF_FUNCLIB_DIFF_H(DTTM,DTTM)

DTTMDIFF_H(Date, Date)

Integer

Date time difference in hours.

PF_FUNCLIB_DTTM_DTTMDIFF_M_UPD

DTTMDIFF_M(Date, Date)

Integer

Date time difference in minutes.

PF_FUNCLIB_DIFF_S(DTTM,DTTM)

DTTMDIFF_S(Date, Date)

Integer

Date time difference in seconds.

PF_FUNCLIB_MATH_ABS_UPD

ABS(Integer)

Integer

Absolute value.

PF_FUNCLIB_MATH_MOD_UPD

MOD(Integer, Integer)

Integer

Modulus.

PF_FUNCLIB_MATH_TO_NUMB_UPD

TO_NUM(Character)

Integer

Convert to number.

PF_FUNCLIB_RTRIM

RTRIM(Character)

Character

RTrim blanks.

PF_FUNCLIB_TO_CHAR_UPD

TO_CHAR(Integer)

Character

Convert to character.

Note: All expression functions are operating system independent and database dependent.