Data Capturing Name-Value Pairs Action – Mozenda (Video)
April 09, 2015
Successfully capturing all the data in a name-value pair list has traditionally been a time intensive process; it has required manually creating Capture Actions for each data point, and often, it made sense to use the Associate with Nearby Text feature to increase accuracy when the data changed position in the list. The new Capture Name-Value Pairs action provides a streamlined way to create the necessary Capture actions in just a few seconds. In this post, we’ll show you when and how to use this new action.
When to use this action
The Capture Name-Value Pairs action is designed to collect data from lists that associate a label or name to each value in the list. The slideshow above provides some common examples of where this action should be used. Many of these lists appear in one of two formats: two vertical columns with the label on the left and the value in the adjacent column to the right (see and example of this in the video above), or a horizontal header followed by its value on a subsequent line.
Your target name-value list may not look exactly like one of the examples shown in the slideshow, but it will be similar enough to identify. The Name-Value Pair action is very flexible and the process to collect data from any of these formats is the same.
Build new Agents in a fraction of the time
Before the Capture Name-Value Pairs action, you would have had to capture a name-value pair list using individual capture actions: one action per name-value pair. Each action would need to be associated with its corresponding label. Furthermore, fields not present on the initial web page used to design the Agent would not be captured when Mozenda encountered them on subsequent pages. This new action accomplishes all of this work and can be created in a few clicks.
Dynamic Field Recognition
With the Capture Name-Value Pairs action, Mozenda identifies the name-value list pattern and creates capture actions for each label it encounters. This happens automatically, whether the Agent is being tested in the Agent Builder or running in the Mozenda Cloud.
Automatically associated with nearby text
Websites have proven to be inconsistent and name-value pairs frequently change their position within their list. To protect against saving the wrong data into a Collection field, traditional capture actions would need to be manually associated with their label using the Associate with nearby text feature. When you use the Capture Name-Value Pairs action this is not necessary because it automatically associates each value with its corresponding label.
How-to: Capture a name-value pair List
Walkthrough
To make the most of this post, find a name-value pair list on a webpage that you are interested in. Next, open that page in the Agent Builder and click Start a new agent from this page and follow along!
1. Click anywhere in the name-value list.
2. In the window that appears, choose Capture name-value pairs:
Notice that instructions for creating this Action are now shown in the upper left panel of the Builder:
3. Click two of the values from the list.
You will now see a preview, confirming which values are being captured, and step two expands:
4. Click on the label associated with the data that is highlighted on the page and designated in the instruction panel:
At this point, the Builder will show you how the name-value pair list will be captured:
5. Click Save.
The action now appears in the action page as Begin Name-Value Pairs List, with a new Capture action created for each individual label within that list.
In the Captured Text Preview panel, you will see how the data will be captured into the output collection. By default, name-value pairs are captured into one row, with each column header being a label from the list, and each cell being its corresponding value:
Renaming fields
By default, the agent will name each column after the labels or “names” on the website. You can, however, change these field names without affecting the accuracy of the collected data. When a name-value capture action is renamed by the user, the agent continues to look for the original label on the page to determine the value that is captured into it. It also begins storing the value according to the new field name specified by the user.
Manage Captured Fields
As with traditional capture actions, the capture actions created inside the Begin Name-Value Pairs List can be refined using the Refine captured text tool. Using that tool you can continue to edit the field expressions and add content replacements.
Exclude certain labels
While the name-value list will capture all fields present in the list by default, labels and their corresponding values can be permanently excluded from the list. By deleting the action for the label you do not want to capture, the Agent Builder will add the label to an exclusion list and will ignore the label and its value whenever it appears. This list of excluded labels can be modified as needed in the action properties of the Name-Value Pair List action. Learn how
Disabling Dynamic Field Recognition
Dynamic Field Recognition is a default function of a Name-Value Pair List action. When a new name-value pair appears in the list, the agent will automatically add a new capture action to collect it. This feature is enabled by default, but it can be disabled if you do not want Mozenda to add new capture actions as new labels are encountered by the agent. Learn how
Name-Value Pair action XPaths
The Name-Value Pair List action has two sets of XPaths that are used to perform its functions. First, the value XPaths are used to identify the html elements that contain the values you want to capture. Next, the header XPaths are used to find the headers or labels that these values should be captured into. The header XPaths are executed relative to the value nodes that are found.
In addition, the XPaths for a capture action inside a Name-Value Pair List are relative to the value node that is selected by the list and can be modified to isolate specific html elements inside of the value.
Additional information
Our Help Center has additional resources including videos and examples for this new action. Please contact our support team if you have any questions about how to use this new action in your Agents.