Structure Irregularities

Sometimes the rows of a table vary in the number of cells they contain. A common way of dealing with such irregularities is to test the format of each table row. For example, you might want to consider only rows containing a certain number of cells, or only rows containing a specific text.

To do this, you add a Try step after the For Each Tag step that loops through the table rows. Each of the Try step's branches handle one format. This can be done by starting each branch with a conditional step with "Try Next Alternative" error handling, for example a Test Tag action that accepts all rows matching some format (written as a pattern). The conditional step is then followed by one or more extraction steps that assume the format accepted by the conditional action. It is sometimes possible to combine the conditional step and the extraction, that is, to just try to do the extraction of a format and if it fails, try the next one.

The following robot uses both approaches. Note that the extraction of the second format is a two-step process. Because "Try Next Alternative" error handling is set up on both steps, the third branch is tried if either of the two steps fails. This represents a fairly complicated condition on the second branch:

When this robot is run, each branch is executed in turn until one succeeds. This implies that the conditions in later branches do not have to repeat the conditions from earlier branches; it is known that they failed.

Note that the branches beyond the conditional steps need not be kept separate. If two or more branches share extraction steps, you may want to merge the branches after the steps that are different.