Skip to main content

Nested Text Overview

While the Sequentum Agent Editor provides a beautiful low-code UI, there is always an Agent file that is created by the UI on the back end of the system. The Agent Editor allows for advanced users to manually edit this file via the Text view. The Agent file is written in the file format NextedText. NestedText is a human readable file format for structured data. It allows users to quickly read and write an Agent without being drowned in verbose file structure properties like XML or JSON.

Writing Nested Text

Introduction

The NestedText View is designed to allow users to create easy-to-read scripts with as little text as possible. If a user wanted to write a quick Agent that launched a browser and navigated to Google it would only take three lines of code.

CODE
Agent: Load Google
	Commands: URL
		Input: https://google.com

Simplification

In an effort to make the the Agent files easier to read and write, the Agent parser uses a number of conventions to reduce the amount of nested text required to configure an agent.

Long Text

The character '>' is used in Nested Text to denote text that spans multiple lines.

CODE
CSV:
	>URL
	>https://training.sequentum.com/productstoscrape/category_html_json
	>https://training.sequentum.com/products

To make it easier to copy/paste long text into an agent, the '>' character can be specified as the property value and all following lines with higher indentation will then be recognized as one piece of text, including empty lines that only contains the indentation.

The following configuration fragment is equivalent to the configuration above.

CODE
CSV:>
	URL
	https://training.sequentum.com/productstoscrape/category_html_json
	https://training.sequentum.com/products

Lists with a Single Element

A list with a single element can be specified as a single property value. The following two configuration fragments are equivalent.

CODE
Paths:
	- //div/p[10]
CODE
Paths: //div/p[10]

Default Values

The Agent Editor will not write command properties that contain default values. For example, when a new Agent is created, the editor UI will show a default height and width of 1200x800.

However the Text View of the Agent does not contain these properties.

CODE
Agent: New Agent
	Commands: 

If you change the width to 1800 on the UI then the Text View will contain a property for the new non-default width but it will still not contain a property for the height.

CODE
Agent: New Agent
    Dynamic Browsers:
        Width: 1800
	Commands: 

Default Properties

Many configuration objects have a single important property that nearly always needs to be set and may often be the only property that is set. Many configuration objects therefore have a default property which value can be specified directly on the object property. For example, the default property of the Select object is Paths so the following two configuration fragments are equivalent.

CODE
Select:
	Paths: //div/p[10]
CODE
Select: //div/p[10]

The default property on all command objects is Name so the following two configuration fragments are equivalent.

CODE
Data List:
	Name: My Data List
CODE
Data List: My Data List

Default properties can be chained. The following two configuration fragments are equivalent because Select is the default property of the Extract object and Paths is the default property of the Select object.

CODE
Extract:	
	Select:
		Paths:
			- //div/p[10]
CODE
Extract: //div/p[10]

An object may have a secondary default property which value can be specified directly on the object property if the primary default property is already specified explicitly. The following two configuration fragments are equivalent because the primary default property on the Extract object is Select and the secondary default property is Attribute.

CODE
Extract: 
	Attribute: HTML
	Select:
		- //div[@class='pageContent']/div/div[2]/div/a
		- //div[@class='pageContent']/div/div[2]/div[2]/a
CODE
Extract: HTML
	Select:
		- //div[@class='pageContent']/div/div[2]/div/a
		- //div[@class='pageContent']/div/div[2]/div[2]/a

Inferred Properties

Sometimes a property can be inferred by the use of other properties. For example, an Input object can have one of four different types of data sources and the type is specified by the Data Source property.

CODE
Input:
	Data Source: Agent Parameter
	Agent Parameter: My Test Parameter

The Agent Parameter property is only relevant when the data source Agent Parameter is selected so by setting the Agent Parameter property, the Data Source property can be removed because it can be inferred.

CODE
Input:	
	Agent Parameter: My Test Parameter

The following two configuration fragments are equivalent because the Data Source property value is inferred and the Static Value property is the default property on the Input object.

CODE
Input:
	Data Source: Static Value
	Static Value: https://training.sequentum.com/
CODE
Input: https://training.sequentum.com/

Reducing Object Depth

Sometimes the object depth to a commonly used property can be quite deep to allow for configuration of related but sometimes rarely used properties. If an object property makes logical sense on its own and it does not conflict with properties on its parent objects, it can be specified directly on a parent object. For example, the following two configurations are equivalent.

CODE
Agent: My Agent
	Browsers:
		Static Browsers: 15
CODE
Agent: My Agent	
	Static Browsers: 15

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.