These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

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?

#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

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:

define(&i, integer, 5)

  show(@(&i, 1, 200)
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.