Articles in this section

chop helper

The chop helper removes leading and trailing whitespace and non-alphanumeric characters from a string. Use it to clean up field values before processing them in a flow.

Syntax

{{chop value}}

value -- The string to clean. Required. Non-string inputs (numbers, booleans) are converted to strings before processing. Arrays of primitive values are converted to a comma-separated string before processing. Objects and object arrays produce unusable output.

Examples

Remove surrounding special characters and whitespace

{{chop record.label1}}
{{chop record.label2}}
{{chop record.label3}}

Input:

{
 "record": {
 "label1": "_ABC_",
 "label2": "-ABC-",
 "label3": " ABC "
 }
}

Output:

ABC
ABC
ABC

Underscores, dashes, and spaces are stripped from both ends of each string.

Preserve interior characters

{{{chop record.label}}}

Input:

{ "record": { "label": " Hello*&^World- " } }

Output: Hello*&^World

Special characters inside the string are preserved. Only leading and trailing non-alphanumeric characters are removed. Triple braces prevent Celigo from HTML-escaping characters such as & and ^ in the output.

Usage notes

  • chop removes non-alphanumeric characters from the start and end of the string only. Characters inside the string body are not affected: "A_B_C" remains A_B_C.
  • Use triple braces ({{{ }}}) when the string contains characters such as &, <, or > to prevent Celigo from HTML-escaping the output.
  • Do not pass objects or object arrays -- the output will be unusable.