A report that loops through one parent file and ten child files with embeds takes minutes to print on SQL (Reported, not reproduced)

Applies to: posted in the Clarion 6 group, generic report template and wizards; the poster describes himself as coming from Legacy. The thread names no further version.

Problem as reported

A report reads one parent file (STATUS) and ten child files (new trucks, used trucks, new trailers and so on). Each child file has its own detail line. The generated report loops through the files in embed code and takes several minutes to print. The poster wanted SQL to do the work, then print the result.

What the thread found

  • Replies pointed at views, which let the SQL side do the processing and appear as a file in Clarion.
  • Another reply: avoid embedded code that fetches other files in the report's TakeRecord. Add the secondary files to the File Schematic through a relation or a custom join expression, so the join runs on the server and saves round trips.
  • The poster answered that the standard ABC template cannot do this with relations, because one parent with ten differently formatted child files needs embeds.
  • A further reply said the SQL the file drivers generate is acceptable when the information is complete: use relations, indexes and filters without embeds. For several loops, a ValidateRecord embed can make each loop print once:
IF LastItm <> COM:NVITM THEN
  LastItm = COM:NVITM
ELSE
  ReturnValue = Record:Filtered
END

The same reply suggested two report procedures called by one process procedure, or one report called twice with arguments.

  • A third reply read each child file once into memory queues, then sorted, handled breaks and printed the details by hand. The memory use of the queues is the cost to watch.
  • The poster said he could create the queues in an embed but did not know how to fill them with SQL statements; he asked for examples. None followed.

Caveats

  • The thread does not say which option was finally used or how much faster it was.
  • The queue approach is hand-coded printing; the poster expected 50 to 150 records per queue.

Today (2026)

Not reproduced. This entry records a 2004 discussion with no confirmed outcome. If you solved the same shape (one parent, many differently formatted child files) on a current build, please say how in the comments.

Sources: Joe T. (Jun 2004, the question), Jim, Sebastian S., Carl S., Jean L., Larry T. (Jun 2004) in softvelocity.public.clarion6.