When we want tasks in Octoparse to extract data based on criteria, the trigger function really comes in handy. However, you may already notice that although there are many trigger conditions to choose from, Octoparse has yet to provide an option to dump a line of data directly when a field is blank.
While it bothers a considerable number of users, there is a quick and easy workaround to this issue.
Step 1. Set a fixed value for the field if the data is not found
- Click on the three dots for more options for the data field
- Select Customize XPath and go to the settings window for Edit element XPath
- Use a fixed value for the data field when data cannot be found
We can use any value that is unlikely to appear in this data field, for example, we can set it as "null" in this case.
- Click Apply to save the settings
Step 2. Add a trigger to dump the data when the fixed value appears
- Go to Extract Data action in the workflow
- Click + Add a Trigger in the Options tab to create a new trigger
- Name the trigger
- Set trigger conditions for the data field to IF data field is "null" (the fixed value we set earlier)
- Choose Dump this line of data from the Do options
- Click Confirm to save