Forcing new pages at will

Q: Suppose I have a table with one field (Item,Character,40) with these records:

  Bananas
  Strawberries
  **New page**
  Apples
  Blueberries
  Kiwi
  Oranges
  **New page**
  Watermelon
  ....etc.....

I want to create a report to list these items, but whenever a value of "**New page**" is encountered, that value must not be rendered, and the next record must be shown on a new page.  How can I do it?

A: Use the canRender event of the text control. In that, you would check for the "** New page**" value, and if it is true, you would return a false. This avoids printing ... however, to get the page eject, use the streamSource's beginNewFrame() method in the same if:

function TEXT2.canRender
   if this.text == "** New page**"
      // this = text control
      // parent = detailBand
      // parent = streamFrame
      // parent = pageTemplate
      this.parent.parent.parent.streamSource1.beginNewFrame()
      return false
   endif
return true