Label Formatter

Agenty LabelFormatter is a way to style a field values into colorful labels, this function can be used in existing field as well a new label field can be added. There are 2 ways to use this function, to add style the field value into a colored label in the result table :

  1. Without parameters
  2. With parameter

In this tutorial, we are going to try both of these options to see how the LabelFormatter function works :

Before

The scraping agent consider all the fields DataType as TEXT by default, so If you see the screenshot below, the ProductPrice field values is all in plain text format :

Without parameters

  1. Edit the scraping agent by clicking on the Edit tab and go to Fields and Collection section
  2. Go to the ProductPrice field and click on the Edit button to edit this field
  3. Now, click on the Add Formatter button as in screenshot below

  1. The below modal dialog box will appear, where we need to select the LabelFormatter in drop-down and then leave the parameter as blank(by-default)

  1. Save the function and the scraping agent configuration
  2. 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 field formatter function just display the text in different styles and doesn’t make any change in actual result data_)

  1. So, when we use the LabelFormatter function and don’t pass any parameter, the function just convert that field values into label.

With Parameter

By using the color parameter, we can change the color of our label :

  1. Just enter any valid color name or hexadecimal color code in color parameter as in screenshot below.

  2. Save the function and the scraping agent configuration

  3. 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 display the text in different styles and doesn’t make any change in actual result data_)

  4. So, when we use the LabelFormatter function with color parameter, the function will style the field value with label with defined color in parameter.

Signup now to get 100 pages credit free

14 days free trial, no credit card required!