# LAST() function

Updated: 10/14/2021, 2:20:00 PM
Created: 10/14/2021, 2:20:00 PM
Last Updated By: mikes
Read Time: 1 minute(s)

# Description

The LAST() function retrieves the last delimited element of a string. The delimiter can be any character.

It takes the general form:

LAST(expression, {delimiter})
1

Where:

  • expression evaluates to the string to be processed.
  • delimiter is optional and can be any character. If not specifed then @AM is used and is the default character. If there is no @AM then @VM is used. If there is no @VM then @SVM is used.

This function can only be use in A; conversions/correlatives or in I-types.

# Examples used with A; conversions or correlatives

A;LAST(6)
1

If attribute 6 contains any @VMs then the last multi-value is returned. If there are no @VMs then the last sub-value is returned.

A;last(2, ",")
1

Returns the last comma-delimited element from attribute 6.

# I-type examples

LAST(@RECORD)
1

Returns the last attribute from the record. This is the same as LAST(@RECORD, @AM)

last(@RECORD<1>)
1

If attribute 1 contains any @VMs then the last multi-value is returned. If there are no @VMs then the last sub-value is returned.

last(@RECORD<3,6>)
1

Returns the last sub-value from the 6th multi-value in attribute 3.

LAST(@RECORD<2>, @TAB)
1

Returns the last tab-delimited element from attribute 2.

Back to Correlative Processing