Agenty HyperLink Formatter function is used to format the agents text fields into clickable-links, the formatter function can be used in existing field as well a new field can be added to keep both, the text and formatted hyperlink to display.
There are 3 ways to use this function to add a hyperlink URL in the result table:
- Without parameters
- Static values in parameters
- Dynamic field names in parameters
In this tutorial, we are going to try each of these to see how the Hyperlink field formatter works :
Before
The scraping agent consider all the fields Datatype as TEXT by default, so If you see the screenshot below the images src, url is all in plain text format:
Without parameters
- Edit the scraping agent by clicking on the
Edittab and go to Fields and Collections section - Go to the field ProductCartLink and click on the
Editbutton to edit this field - Now, click on the
Add Formatterbutton as in screenshot below:
-
The below modal dialog box will appear, where we need to select the
HyperLinkFormatterin drop-down and then leave the parameter as blank(by-default): -
Savethe function and the scraping agent configuration -
Go back to result tab
(Remember: There are no need to re-run the agent to apply the changes we made in formatter, because the formatter function just displays the text in different styles and doesn’t make any change in actual result data)
- So, when we use the
HyperLinkFormatterfunction and don’t pass any parameter, the function just convert that field values into a click-able link if the value is a valid hyperlink (starts withhttporhttps)
Static values in parameters
We can also use the HyperLinkFormatter function to add a static click-able link field in agent result to go to any website or url you want. In order to do that, we just need to add a new field and then the formatter with static values in href and text parameters
-
Add a field, name it something as I did AmazonURL
-
Click on the
Add Formatter -
Select the
HyperLinkFormatterand enter the static values inhrefandtextparameters you want to add the hyperlink for: -
Then,
savethe function and the agent configuration and go back to result tab to see the output:
Dynamic field names in parameters
We can also use the HyperLinkFormatter function to create links dynamically by using the values in other fields in same row. For example, I can create a hyperlink field using the anchor text in ProductName and href in ProductCartLink field dynamically for each row. The only difference is, we need to use the field name in parameters and the function will automatically pick the value in corresponding row and create the link in result table.
For example, follow some easy steps with me to convert the ProductName existing field into link with URL from ProductCartLink for each row.
- Edit the scraping agent by clicking on the
Edittab - Go to ProductName field and click on the
Editbutton to edit this field - Click on the Add formatter function to add the formatter
- Now, enter the ProductCartLink field name in
hrefparameter and ProductName field name intextparameter, as in screenshot below:
-
Savethe function and agent configuration - Go back to result tab and see the formatted field output:







