- 1 Minute to read
- Print
- DarkLight
fn:length
- 1 Minute to read
- Print
- DarkLight
The function fn:length returns the string length or the number of items in a collection. The value returned is an integer data type.
This is a third-party function. For more information, see JSTL functions.
Example
Shopping cart information is stored in a related data set. This data is included in a sendout to customers with abandoned carts. An expression counts the number of items in an abandoned cart and inserts this number in a message. The related data set is named Carts. The data is linked to the user attribute user.Email.
The function determines the number of items in the cart by counting how often the customer's email address appears in the related data set. The expression that inserts this information in a message is constructed as follows:
<%${fn:length(user.relatedAttribute['Carts'])}%>
Structure
fn:length(object)
Parameters
Parameter | Description |
---|---|
object | Specifies the target object. |