Command hierarchy

In ParseHub, you create commands in the ParseHub menu on the left, that tell ParseHub how to get the data you need.

ParseHub structures projects in a tree. Everything in a project is nested underneath a "template node," shown as Select page.

Understanding the flow of commands

Most commands can have children, which are only executed if the parent node can be executed first. Otherwise, these commands are skipped over.

This also means if a command is executed multiple times, for example, like a select command that picks 20 elements from a page, then its children will be executed multiple times as well!

The structure of a project's commands can be very important, because of this. Commands are executed from top to bottom, and skipped over if their parent isn't executed. In this way, Select commands can act like Conditionals, because their children won't be executed if nothing is selected.

Working with multiple templates

When a Click or Go to Template command goes to a new page, the template is started from the beginning.

Sometimes, this template will run at the same time as the original template and parallelize the process, to speed up your run.

ParseHub will automatically offload the work to another server, then continue with executing the current template. This means that commands after the Go to Template command can be executed while the new template is still running. This sometimes results in unexpected behaviour. For example, a list may be in a different order than it appears on the pages.

ParseHub will automatically figure out when it needs to wait for the go to template command to finish. For example, if the new template extracts a variable that is used by a later command in the original template, ParseHub will wait for that template to finish before continuing in the original template.

Common mistakes with command hierarchy

1. Adding the command to select a next button at the wrong spot

A poorly-constructed command chain.

When you need to paginate for data across many pages, it's important to make sure that the Select next_button command isn't a child of the selection to get each item on a results page. Otherwise, you'll go to the next page for each item, meaning you'll get the second page twenty times, and very nasty looking results.

2. Getting data from a page with 'infinite scrolling' (loads new data when you scroll to the bottom)

A poorly-constructed command chain.

If a page loads more information by scrolling down, you need to make sure that you have a command that scrolls to the bottom of the page several times before the commands that extract data, otherwise you'll be missing whatever loads after the first time you scroll.

3. You need to click a button to show more information about a product

A poorly-constructed command chain, showing where the Select showMore command should go.

For the exact same reason as number two, if there's an item that needs you to click a "Show More" button before you can extract the information you need, make sure that you put the click command before selecting the extra information.

Have more questions? Submit request!


Please sign in to leave a comment.