Text Transformer

Transform text in various ways

Overview

This node, named Text Transformer, performs various text transformations on input data fields. It supports operations such as converting text to upper case, lower case, trimming spaces, counting words, and generating URL-friendly slugs. It is useful in scenarios where text data needs to be normalized, cleaned, or analyzed within an automation workflow, for example, preparing user input for database storage, generating slugs for URLs, or counting words in a text field.

Use Case Examples

  1. Counting the number of words in a user comment field to analyze comment length.
  2. Generating a slug from a product name for use in URLs.
  3. Trimming extra spaces from a text input before saving it.

Properties

Name Meaning
Source Field The name of the input field containing the text to transform.
Destination Field The name of the output field to put the transformed text. If left empty, the original field is replaced.

Output

JSON

- The transformed text or word count result stored in the specified destination field or replacing the source field if destination is empty.

Troubleshooting

  • If the specified source field does not exist in the input data, the node throws an error indicating no data found for that field. Ensure the source field name is correct and present in the input.
  • If an unsupported operation is selected, the node throws an error indicating the operation is not supported. Verify the operation name is one of the supported options: toUpperCase, toLowerCase, trim, countWords, generateSlug.
  • When counting words, empty or whitespace-only strings result in a count of zero, which is expected behavior.

Discussion