On some projects you may wish to have a variable with a numerical value that increases for each element you have selected. For example, if you have a list of search results you may want to extract the rank number for each result.
To demonstrate, we will be scraping the used inventory for the Ferrari of Ontario website.
1. Open ParseHub and start a new project with the URL http://www.ferrariofontario.com/used/ - Click on "Start project on this URL"
2. Click on the + sign next to "Select Page", go to "Advanced" and choose an Extract command.
3. Name the command "count" and set the value (where it says $location.href) to count || 0
4. Click on the + sign next to "Select Page" and choose a Select command.
5. Click on the first item you would like to select on the page (in this case the first car name) and then on one or two more of the same item (the second and third car names) until all items you would like to scrape are highlighted in green. Your selection should show the number of items that have been selected. You can rename this, for example, to "Cars".
6. Click on the + sign next to "Select Cars" and choose an Extract command. Name the command "count" and set its value (where it says $e.text) to count + 1
7. Click and drag the "Extract count" command up to just under your selection and before the "Begin new entry in Cars".
8. Click on the + sign next to "Begin new entry in Cars" and choose an Extract command. Name the command "rank" and set its value to count
On following these instructions, you should have a column called "rank" on each of your results that will display their order on the results list.