OL Learn

Data.extract(left, right, verticalOffset, regionHeight, separator)

Hi,

I want if I could get some help with setting a Repeat condition.

I have a text file from which I am extracting a detail table. I need to set a condition for the Repeat step.
The step needs to loop Until a certain line (the total values line is not empty).

Now the problem is that there is nothing unique to identify the total value line. It can only be identified by its position in the file.

Before the Repeat step, I have an Action step which calculates with accuracy the position of the total value lines:

var total_values_line_no= (steps.totalPages - 1)*66 + 46;

66 here is the number of lines per page.

The total values line will be this line OR the next line: total_values_line_no+1

So if my text file has one page the total values line will be line 46 or line 47.
If my text file has 2 pages, the total value line is 112 or line 113
and so on.

I set my Repeat step to:

Repeat until statement is true

data.extract(1,80,total_values_line_no,1,’< br />’); is not empty

There is a combine OR condition which checks if:

data.extract(1,80,total_values_line_no +1,1,’< br />’); is not empty

But somehow an out of bound error on the Repeat loop.

If I replace with actual values data.extract(1,80,46,1,’< br />’) or data.extract(1,80,47,1,’< br />’), in the case of a single page, then it seems to work.

Can I pass dynamic parameters to the data.extract() method in this case?

Many thanks.

I think the issue was that my verticalOffset was not computed correctly. It always assumed that the current position was the start of file.

var total_values_line_no = (steps.totalPages - 1)*66 + (46-steps.currentPosition);

where steps.currentPosition will always be lower than 46.

this works very well.