All Collections
FAQ
What if I want to dump a line when a field is empty?
What if I want to dump a line when a field is empty?
Updated over a week ago

You are browsing a tutorial guide for Octoparse's latest version. If you are running an older version of Octoparse, we strongly recommend you upgrade because it is faster, easier and more robust! Download and upgrade here if you haven't already done so!

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

customize_XPath.jpg
  • Use a fixed value for the data field when data cannot be found

1.jpg

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

2.jpg
  • 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

3.jpg
Did this answer your question?