Transforms an input value using a Ruby compliant lambda expression.


xplenty_rb.transform(val, lambda_expression)


  val - any value (can be a simple data type or a complex data type

  lambda_expression - string containing a Ruby compliant expression to manipulate the input value.


xplenty_rb.transform('f818', '|x| x.to_i(16)') returns 63512

xplenty_rb.transform(JsonStringToBag('[1,2,3]'), '|x| x.to_a[0][0]') returns 1
* to_a is used to transform a bag into an array. [0][0] is used becasue bags contains tuples (arrays) of fields.

xplenty_rb.transform(JsonStringToBag('[1,2,3]'), '|x| x.join("")') returns 123

Return value datatype

Binary (byte array). You may further cast the returned value in order to pass it to other functions.

Impact of null value

If input is null, returns null.

If the lambda expression is null or erroneous, the function fails.

Feedback and Knowledge Base