Finally – a Glance in the Crystal Ball

An often required feature for "this cannot be done" type of problems is looking into the future. Things like "don't print this group if it doesn't contain record xy" or "print a reference to the page number of an item that's printed way later". Before List & Label 26, there was no simple solution to this and the magic had to be done in the application if possible at all. Starting with List & Label 26, we'll introduce a new feature that's aimed at solving exactly challenges like this.

The solution is an automated multi-pass printing. We made sure to make this as flexible as possible. You can decide to show the passes in the result, which enables similar things like the issue printing. However, this time offering full flexibility and not being restricted to just showing or hiding objects. You can also hide passes, e.g. all except the last, and work with SetVar() and GetVar() to talk to your future self. Sounds crazy? Let’s dive into it.
 

Example: Page References

As an example, let’s take a sales report for which we’ll add a management summary. The (hypothetic) report consists of a cover sheet with a management summary and two pages of charts. The challenge is to reference the page numbers of the charts in the summary. The basic layout looks like this:

Object Structure

The solution now is simple. Just add a SetVar to the headline of the respective charts, e.g. like this:

"Sales by customers"+SetVar("Reference.Chart1", Page$(), false)

SetVar is a powerful function that allows to store arbitrary values for future reference. The first parameter can be named arbitrarily. Setting the third parameter to “false” makes sure nothing is actually printed. In the “Summary” object, we can then reference this variable like this:
Multi-pass reference

Now all we have to do is to set the pass count to 2. This will result in SetVar() being called before the actually visible GetVar() in pass two, even though the GetVar() is printed first. This way, we get the required page references:

Multi pass chart reference
 

Example: Flexible Copies

List & Label already supports a kind of similar feature – printing multiple issues. If you set the issue count e.g. to two, you’ll get a copy of the original print but can add a “Display Condition for Issue Print” to an object. The cool part is, this will just need one pass and still allow to show or hide certain objects in the copy. However, this is the only thing you can do – the copy is identical in every other means. A typical usage for issue printing is e.g. printing a “Copy” watermark on an invoice.

If you need more flexibility, the passes are here for the rescue. The origin of this feature comes from Idea Place, our portal for user innovation. As an example, let’s have a combined invoice and delivery note print. While they’re quite similar, you need somewhat different informations on the slip. 

Let’s change the header from “Invoice” to Delivery Note” for the second pass. It’s simple:

Cond(PrintPassIndex()==1, "Invoice", "Delivery Note")

This reads “if we’re in the first pass, print “Invoice”, otherwise print “Delivery Note”. As for the item table itself, it’s easier to add an entire new table to the report container and adjust the appearance conditions:

Invoice Item List

For this example I just copied the invoice table but removed all prices for the delivery note. Here’s the result in a side-by-side-view:

Multi Pass Side-By-Side-Result

Internally, this feature makes use of the combination print feature that’s also new in List & Label 26. Thus, it has the same requirements – a DataProvider implementation which is available for .NET, VCL and C++.

I’m looking forward very much to seeing what else this feature will be used for – it’s an all-purpose-answer for many requests we’ve received in the past. 

More new features in List & Label 26:
What’s New for .NET?
Powerful, Reusable Sub-Reports for Your Reports
New Drag & Drop Features for the Table

Related Posts

Leave a Comment