icon-arrow-down-xplenty

xplenty_rb.concat_bag

Description

Returns a string of the concatenated values in an input bag (array).

Syntax

xplenty_rb.concat_bag(bag,separator,lambda_expression)

Arguments

  bag - bag. 

  separator - string to insert between the concatenated values. Can be an empty string or null

  lambda_expression - Ruby compliant expression to manipulate the bag prior to concatenation, such as sort or filter. 

Examples

bag1 is [(a),(c),(b)]

xplenty_rb.concat_bag(bag1, '-', '|bag| bag.sort_by { |tuple| tuple.last }') returns the string a-b-c.

* The inner lambda expression is required because the bag actually contains tuples (manifested as arrays) of fields - in this case, arrays of a single element.

Return value datatype

String.

Impact of null value

If input bag is null, returns null.

If the lambda expression is erroneous, the function fails.

Feedback and Knowledge Base

icon-arrow-down-xplenty