Data Text Formatter
The Data Text Formatter is a utility tool designed to help you clean and standardize text data before it is used by other parts of your automation system. Think of it as a “text cleaner” or a “data wrangler.”
When you receive raw data from forms, APIs, or user inputs, it often contains extra spaces, inconsistent capitalization (like mixed case), or special characters and accents that might cause errors later. This component allows you to automatically fix these issues. For example, you can automatically convert names to Title Case, remove accents from words (changing “café” to “cafe”), or replace spaces with underscores (changing “my file name” to “my_file_name”).
How it Works
This component works locally within your workflow. It takes your raw text data and applies a series of “cleaning” rules that you define.
- Target Selection: You tell the component which parts of your data need cleaning (either all text fields or specific ones you name).
- Application of Rules: The component applies your chosen rules, such as:
- Case Conversion: Changing text to uppercase, lowercase, or proper title case.
- Accent Removal: Stripping accents from letters (e.g., turning “Él” into “El”).
- Trimming: Removing extra empty spaces from the beginning and end of sentences.
- Replacing: Swapping specific characters (like turning spaces into hyphens) or finding and replacing custom text patterns.
- Output Generation: Once the cleaning is complete, it passes the fresh, standardized data to the next step in your automation.
Connection & Credentials
This component does not require any external credentials, API keys, or connections to external services. It processes data directly within the Nappai environment.
Inputs
The following fields are available to configure this component. Note that some advanced options (like “Replace Characters”) are hidden by default and will only appear when you enable them.
- Data: The raw text or message objects you want to clean. You can connect multiple data inputs here.
- Target Keys: A comma-separated list of specific field names you want to format (e.g.,
name, email). Leave this empty to apply the rules to all text fields in your data. - Case Conversion: Choose how you want the capitalization to look. Options include
None,lowercase,UPPERCASE, orCapitalize(e.g., turning “hello world” into “Hello World”). - Remove Accents: Toggle this on to automatically strip accents from letters (e.g., “naïve” becomes “naive”).
- Trim Whitespace: Toggle this on to remove extra blank spaces at the start and end of your text.
- Replace Spaces: Toggle this on if you want to replace standard spaces with a specific character (like a hyphen
-or underscore_). - Replace Spaces With: The character to use when you enable “Replace Spaces” (e.g.,
-). - Replace Characters: Toggle this on to find and replace specific text patterns. For example, find “old_text” and replace it with “new_text”.
- Number of Replacements: How many custom replacements you want to make (up to 5).
- Find: The text you want to search for.
- Replace with: The text you want to put in place of what you found. Leave blank to delete the text entirely.
Outputs
- Formatted Data: The clean, processed text data ready for the next step in your workflow.
Output Data Example (JSON)json
[ { “text”: “Hello World”, “attributes”: { “name”: “Juan Perez”, “city”: “Mexico City”, “price”: “10.50” } } ]
Connectivity
This component is typically used as a bridge in your workflow.
- Connection In: Connect the output of a Data Extractor, Web Scraper, or Form Input component. These sources often provide messy or raw data.
- Connection Out: Connect the output to an AI Assistant (LLM), a Database Writer, or an Email Sender. These downstream tools usually require clean, standardized data to work correctly.
Usage Example
Scenario: You are building an automation that collects customer names from a website form and sends them to a CRM. The names often have extra spaces, mixed casing, and accents.
- Connect the Form Input to the Data Text Formatter.
- In Target Keys, leave it empty to clean all text fields.
- Set Case Conversion to
Capitalize. - Turn Remove Accents to
True. - Turn Trim Whitespace to
True. - Connect the Formatted Data output to your CRM Create Record node.
- Result: A name like
" JUAN Pérez "is automatically cleaned to"Juan Perez"before being saved.
- Result: A name like
Related Components
- Data Extractor: Often used before this component to pull raw text from websites or documents.
- AI Assistant: Often used after this component to analyze the cleaned text.
Tips and Best Practices
- Preview Before Saving: If you are unsure about your formatting rules, try connecting this node to a Text Viewer first to see the results before sending data to critical systems like databases.
- Target Specific Keys: Instead of leaving Target Keys empty, specify the exact field names (e.g.,
first_name, last_name). This prevents the tool from accidentally changing data in fields you didn’t intend to touch (like ID numbers or prices). - Use Case Conversion Carefully: If you are formatting names or addresses, use
Capitalize. If you are formatting emails or URLs, uselowercase. - Dynamic Replacement: Use Replace Characters to standardize phone numbers or remove special symbols that might break integrations.
Security Considerations
- This component processes text locally. Ensure that the data you are passing through it does not contain sensitive personal information (PII) if your workflow has logging enabled that might capture the raw input.