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

LAST

LAST

Returns the last row in the selected port. Optionally, you can apply a filter to limit the rows the
PowerCenter Integration Service
reads. You can nest only one other aggregate function within LAST.

Syntax

LAST(
value
[,
filter_condition
] )
The following table describes the arguments for this command:
Argument
Required/
Optional
Description
value
Required
Any datatype except Binary. Passes the values for which you want to return the last row. 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

Last row in a port.
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).
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.

Example

The following expression returns the last row in the ITEMS_NAME port with a price greater than $10.00:
LAST( ITEM_NAME, ITEM_PRICE > 10 )
ITEM_NAME
ITEM_PRICE
Flashlight
35.00
Navigation Compass
8.05
Regulator System
150.00
Flashlight
29.00
Depth/Pressure Gauge
88.00
Vest
31.00
RETURN VALUE:
Vest