OL Learn

Condition returns unexpected results

I am trying to extract line data from a text file into a detail table.
I am using a condition to limit the lines selected.
I want the 3 lines upto and including the line containing a certain tag.
Here is my condition setup.

The condition works fine in the middle of a page of data,
but fails when the target of the condition is at the end of the input page.
I suspect that the data selector (6,+0,12,+3) is not returning anything when there are fewer than 3 lines left on the page.
Is this the expected behaviour?

Another similar issue in text files-
A selector with height > 1 never returns “is empty” regardless of the contents of the data file.
In this case I can test one line and then in a separate condition test the next.
Or, of course, script it.

For your first issue, I’m not quite sure how you’re going at it because it works on my end.

But regardless, I think the proper way of doing this would be to loop through all lines (with the GOTO step inside the loop set to “next line with content”). Then your condition looks for the word “Price” and if it finds it, an Extract step can extract this line and the two previous ones by setting its Top offset property to -2.

As for your second issue (empty multi-line selections), you are right: it does indeed look like a bug. I have reported it to our development team and have asked them to fix it in a future version (unfortunately, it’s too late to include a fix in the version coming out this week).

Firstly, sorry for putting 2 issues on 1 post - I resolve to try and stop doing that.
I have worked around the first issue, by looking for different data, extracting in another order etc.
But the underlying issue is still there - a condition that uses a data selector that extends beyond the page margins always returns false, regardless of the data. I think the detail loop is a distraction, so I have an example without looping.
Here is a condition that works -

and here is the same thing but with height increased by 1

The extra line takes the data selector past the end-of-page and the condition now returns false.

The same problem occurs when a negative top offset takes the selection area above the top of the page.

Ah, I see now how to replicate the issue: the problem doesn’t occur over page boundaries inside the same document (which is what I tested previously) but it does occur at the end of a record, when the data selection extends beyond the last line of the record.

When you base that condition on Javascript, we can see that the equivalent statement generates a JS error, which explains why basing it on Position also fails. The negative offset is the same issue: as soon as the data selection extends beyond the Record boundary, an error is generated internally, preventing the condition from being evaluated properly.
Fortunately, as you mentioned earlier, the workaround is relatively easy, using JS code to trap the error.

Still I will report this issue to our team as well.

For reference, our internal ticket numbers for the issues are:

  • SHARED-74434: Is Empty condition does not work with multi-line selections
  • SHARED-74451: Text condition fails if data selection extends beyond record boundaries

Any time you want to inquire about progress on these issues, use those reference numbers.