Learn about the built-in Value Parser Tool available in Flows.
This article contains the following sections:
What is the Value Parser Tool and what does it do?
The Value Parser tool in Knack Flows allows you to break down a text string or data field into specific parts, which you can then use in subsequent steps of your flow. This is particularly useful for isolating values within JSON data, email addresses, phone numbers, or any structured text where portions of the data hold unique significance.
In the settings of the tool, you have the ability to define specific parameters for your parsing needs:
- What to replace: This can include symbols, characters, words, or custom sets (templates), among others.
- Replace with: You can specify symbols, characters, or custom sets (templates) to substitute the original content.
While a basic character search functions similarly to the Find and Replace built-in tool, utilizing Regular Expressions enhances your capabilities. With Regular Expressions, you can effectively search for multiple characters, exclude certain elements, and implement various rules to refine your data extraction process.
When to Use the Value Parser Tool
Use the Value Parser Tool whenever you need to:
- Extract specific values from JSON data
- Separate components of a structured text string
- Access individual elements within a delimited list or other structured data
- Clean up data by isolating only the elements needed for processing in subsequent steps
Examples of use cases:
- Case 1: Converting the date format from
DD.MM.YYYY
toYYYY_MM_DD
- Tool Settings:
- Value to process: [date value]
- Replacement template:
([0-3]\d).([01]\d).(\d{4})
- Replace with:
$3_$2_$1.
- Tool Settings:
- Case 2: Remove tags from an email value
- Tool Settings:
- Value to process: [email value]
- Replacement Template:
<(/?[^>]+)>|(\n)|(\s{4,})
- Replace with: Space
- Tool Settings:
Note: The possibilities for crafting templates and combinations are vast, and numerous online resources are available to help you explore this further. See a few resources here: Getting Help With Regular Expressions
How to Access and Apply the Iterator Tool to Your Flows
After selecting the Flow where you want to utilize the Value Parser Tool, identify the specific steps within the Flow that require the application of your desired conditions.
You can then add a Tool by clicking on the "+" button underneath each necessary step. Clicking the "Tool" option will allow you to select from a range of different tools Flows offers, including the Value Parser Tool.
Tips for Using the Value Parser Tool
- Double-Check Data Structure: Confirm the format of your data (e.g., JSON, CSV, or text) to set up parsing rules accurately.
- Use Parsing Rules Wisely: Depending on your data, use delimiters, regex, or specific indexes to isolate the information effectively.
- Test Parsing Results: To ensure accuracy, test the tool on various data samples to confirm the rules work consistently across different inputs.
FAQs
What types of data can the Value Parser Tool handle?
The Value Parser Tool can parse text, JSON data, and other structured text formats. It’s flexible enough to handle most delimited lists or fields where consistent patterns are present.
How do I parse multiple values within the same string?
If you need to isolate multiple values, use separate tool steps of the Value Parser Tool for each required extraction.
Can I use the Value Parser Tool on data from other apps?
Yes, any data imported into Knack, whether from an API, file upload, or manual input, can be parsed with this tool as long as it’s in a compatible format.