Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Function Library Creates Duplicate Output

Formula Help

User Function Library Creates Duplicate Output

by  chelseatech  Posted    (Edited  )
User Function Libaries (UFL) are supposed to be stateless. That means that it starts with some values, does all the processing required and then finishes it's work. The next run of the formula doesn't remember the values from the previous run

However, you can write a UFL that does remember state, and you can use a series of functions inside formulas to build disk files, write XML documents, send email to a SMTP server, etc. We have several of these already written and available from our web site.

An occassional problem occurs with these. It appears that the UFL is processed more than once, but only every now and then. Discussions with CD revealed that this is because the section is processed, formatted and then checked to see if it will fit on the bottom of the page. If it doesn't fit, the page footer and header are processed, and the section is reprocessed for the top of the new page.

To remove this problem do the following...

1. Write the report that uses your UFL functions in formulas.

2. Create a section above the section where you do all the work, Details (a). This section must have a height, and canÆt be suppressed or set to Underlay. Using Underlay, Suppress or Suppress Blank Section on this section all cause duplicate records.

3. Create a set of formulas as followsà
Reset Counter: Place in RH and PF sections
WhilePrintingRecords;
global numbervar c:=0

New Line: Place in the Details (a) section.
This can be formatted with ôSuppressö
WhilePrintingRecords;
global numbervar c:= c + 1

4. Set a conditional ôNew Page Afterö on Details (a)
WhilePrintingRecords;
global numbervar c;
c >= 60
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top