Transforms | Yext Hitchhikers Platform
What You’ll Learn
In this section, you will learn:
- What transforms are
- The type of transforms that are available with Connectors
Overview
Transforms allow you to manipulate incoming data in the Connectors workflow, eliminating the need to perform these actions before the data enters Yext. After choosing a transform action in the Connector workflow, you can preview the changes in real time. Additionally, you can add as many transforms as you’d like.
The following transforms are available:
- Remove Characters
- Fix Capitalization
- Filter Rows
- Find and Replace
- Add Column with Static Value
- Format Dates
- Extract Text
- Merge Columns
- Functions
Apply a Transform
To add a transform click Add Transform in the sidebar and select the desired transform. Then you will select which columns you want to apply the transform to. Then select from the support options for that transform. For example, in the screenshot below we have chosen the ‘Fix Capitalization’ transform for 6 columns, and we are applying the ‘All Caps’ option.
Once you click Apply, the data table preview on the right side will update accordingly based on the select transforms. Once you have applied your transform you can add additional transforms as it’s relevant.
Below we will go through the available transform options and some supporting examples.
Remove Characters
This transform trims spaces and removes all unwanted special characters, numbers or spaces from the inputted columns of data.
For example, if the data you pulled in from your Connector looks like the example below, you can apply the ‘Remove Unwanted Characters’ transform to the Year Established Column to remove the slash.
Location Name | Year Established |
---|---|
Turtlehead Tacos | /2013 |
Turtlehead Tacos | /2005 |
Turtlehead Tacos | /2014 |
Fix Capitalization
This transform converts the text of the inputted columns by applying the selected capitalization options:
- All Caps
- All Lower Case
- Proper Case
- This capitalization the first letter of every word (e.g., This Is Proper Case)
Filter Rows
This transform allows you to remove or keep rows based on a filter criteria provided. For example, the criteria can be one of the following:
- is blank
- is not blank
- equals
- does not equal
- contains
- does not contain
- greater than
- greater than or equal to
- less than
- less than or equal to
For example, if you want to upload product data, but you don’t want to upload any inventory that is out of stock you can use this transform to remove data that matches the criteria of ‘In Stock’ equals ‘No’. This would only upload the first two rows from the dataset below:
Product Name | In Stock | Product SKU |
---|---|---|
T-shirt | Yes | 123456 |
Tank top | Yes | |
Sweatpants | No | 4567890 |
When using the ‘Filter Rows Based on Criteria’ transform, you can apply multiple criteria. You can select either AND conditionals, or OR conditionals.
Meaning, you can exclude products that are both out of stock, and do not have an associated product SKU. Or, you can exclude any products that are either out of stock or missing a product SKU.
Find and Replace
Replace the current cell value with a specific value that you provide.
This transform respects blanks, so:
- If ‘Find Value’ is left blank, the transform will look for empty cells
- If the Replace With field is left blank, the value of ‘Find’ criteria will be replaced with a blank cell.
By default the transform will ignore casing, but if you would like to respect casing you can toggle this on.
Add Columns with Static Value
This transform will add a column to the given data set with repeating row values that you specify.
To do this you will enter a Name for the column you’d like to add, and the repeating value of that column.
The value entered will apply to all rows, so this is something that applies to everything in the data set you are looking to load into Yext.
Extract Text
This transform will extract text from a column based on matching characters or offset. To do this you will enter the name of the new column for the extracted data. Then you will select the operation:
- All Text After
- All Text Before
- Some Text After (find a subset of text)
- Some Text Before (find a subset of text)
Next you enter the desired ‘Extract From’ setting — this specifies where the text should be extracted:
- First Instance of Matching Text: Delimit on the first instance of the matching text
- Last Instance of Match Text: Delimit on the last instance of the matching text
- Offset From Beginning: Determines the delimiter based on the provided Offset Length starting from the beginning of the text
- Offset From End: Determines the delimiter based on the provided Offset Length starting from the end of the text
Finally, you enter the Matching Text, which is the text to search for that will queue the extraction.
For example, you may want to extract usernames from a list of emails. To do this you can use the ‘All Text Before’ Operation where the ‘Extract From’ setting is the ‘First Instance of Match Text’, and the matching text is ‘@’.
Name | Username | |
---|---|---|
Marty Morris | mmorris@turtleheadtacos.com | mmorris |
This would add the new ‘Username’ column above to your dataset.
Or, you may want to extract store IDs from a relative URL path. The URL path is consistent for each store, therefore they should use the offset option where the Extract Option is ‘All Text After’ and your Extract From setting is ‘Offset from Beginning’ and the Offset Length is 20.
Name | Address | Relative URL | Store ID |
---|---|---|---|
Turtlehead Tacos | 123 Main Street | /turtleheadtacos/ca/store12 | store12 |
This would add the new ‘Store ID’ column to your above dataset.
Merge Columns
This transform will merge columns together with an optional delimiter. To do this, you select the columns you want to merge from the drop-down menu. The order of the columns you select will determine the order of the merged data.
For example, if you have a column with the URLs from the main domain of your page, and you have a separate column for your Store IDs, you can merge the columns to create the store specific URLs.
To do this, you would merge the URL column with the Store ID column, and use ‘/’ as the delimiter. This would add ‘Full URL’ as a new column to the below dataset.
Location Name | URL | Store ID | Store ID |
---|---|---|---|
Turtlehead Tacos | https://https://turtleheadtacos.com |
store12 | https://turtleheadtacos.com/store12 |
Functions
Functions are custom transforms. You can create a fully customized Function in TypeScript.
All Connector Function Transforms will expect a single generic function signature, outlined below in TypeScript.
export function myCustomTransform(cellValue: string): string {
/** TODO: build transformed cell */
return cell;
}
When creating a Function Transform, you must specify which Columns in the Table that you would like to transform. The Connector system will make a separate function call for each Cell in each specified Column in the Table, hence the singular string argument and expected return value.
After creating a custom transform, you can then select the function in the UI as you would select a built-in transform.
To learn more about creating functions visit the Get Started with Yext Functions guide.