Table of Contents

Search

  1. Preface
  2. The Transformation Language
  3. Constants
  4. Operators
  5. Variables
  6. Dates
  7. Functions
  8. Creating Custom Functions
  9. Custom Function API Reference

Transformation Language Reference

Transformation Language Reference

MAX (String)

MAX (String)

Returns the highest string value found within a port or group. You can apply a filter to limit the rows in the search. You can nest only one other aggregate function within MAX.
The MAX function uses the same sort order that the Sorter transformation uses. However, the MAX function is case sensitive, and the Sorter transformation may not be case sensitive.
You can also use MAX to return the latest date or the largest numeric value in a port or group.

Syntax

MAX(
string
[,
filter_condition
] )
The following table describes the arguments for this command:
Argument
Required/
Optional
Description
string
Required
String datatype. Passes the string values for which you want to return a maximum string value. You can enter any valid transformation expression.
filter_condition
Optional
Limits the rows in the search. The filter condition must be a numeric value or evaluate to TRUE, FALSE, or NULL. You can enter any valid transformation expression.

Return Value

String.
NULL if all values passed to the function are NULL, or if no rows are selected (for example, the filter condition evaluates to FALSE or NULL for all rows).

Nulls

If a value is NULL, MAX ignores it. However, if all values passed from the port are NULL, MAX returns NULL.
By default, the
PowerCenter Integration Service
treats null values as NULLs in aggregate functions. If you pass an entire port or group of null values, the function returns NULL. However, when you configure the
PowerCenter Integration Service
, you can choose how you want to handle null values in aggregate functions. You can treat null values as 0 in aggregate functions or as NULL.

Group By

MAX groups values based on group by ports you define in the transformation, returning one result for each group.
If there is no group by port, MAX treats all rows as one group, returning one value.

Example

The following expression returns the maximum item name for manufacturer ID 104:
MAX( ITEM_NAME, MANUFACTURER_ID='104' )
MANUFACTURER_ID
ITEM_NAME
101
First Stage Regulator
102
Electronic Console
104
Flashlight
104
Battery (9 volt)
104
Rope (20 ft)
104
60.6 cu ft Tank
107
75.4 cu ft Tank
108
Wristband Thermometer
RETURN VALUE:
Rope (20 ft)

0 COMMENTS

We’d like to hear from you!