Topic Options
#30165 - 05/28/09 05:34 PM Repeat Until
scrabtree Offline
Junior Member

Registered: 12/17/01
Posts: 21
Loc: 7131 S. Riverside Dr.
I need to read in lines of invoice data and write them out until I find 'subtotal' at ¤t.line,20,27. That tells me my line item detail is done. Does anyone have any examples as to how to accomplish that?

Top
#30166 - 05/29/09 01:37 PM Re: Repeat Until
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
scrabtree,

Using the standard data selection repetition, I don't really see how you can make that kind of condition, because there is no ways to "break" the repetition when you find it. You could always create a global function that returns the line of the "subtotal", and use this function as the "to line" parameter of a line repetition, but an easier way may be to use a PressTalk object instead of a data selection.

Here's an example of such a presstalk object's code:

Code:
define(&i, integer, 5)

repeat
  show(@(&i, 1, 200)
  crlf(0.1429)
until((@(&i, 20, 27) = 'subtotal') or (&i >= &current.lpp))
This code will start reading your items from line 5(it can start anywhere, just use the first line of your own data), and will display every lines until it finds the one that has "subtotal", or if it reaches the end of the data page(in cases you would have data files that have no subtotals). This example displays the entire line with up to 200 character(starts at character 1 and go to 200), but you can adjust that to whatever you want.

Hope that helps.

Regards,
Rapha

Top