News combit Dev Blog

Finally – a Glance in the Crystal Ball

Posted: Monday, October 19, 2020 | 0 comment(s)
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

Author: Jochen Bartlau
Head of Development List & Label

Jochen Bartlau leads the development at combit as Managing Director. He's a Microsoft .NET enthusiast driving innovation & agile project management. The mobile devices geek who used to be a physicist in his first life loves to spend his spare time with his family.


combit Development BlogRSS
What’s this blog for?
A place to share updates about the ongoing development of our products. General musings on the software industry included.
April 2021 (2)
March 2021 (1)
February 2021 (2)
January 2021 (1)
December 2020 (2)
November 2020 (1)
October 2020 (2)
September 2020 (1)
August 2020 (2)
July 2020 (1)
June 2020 (1)
May 2020 (2)
April 2020 (2)
March 2020 (2)
February 2020 (1)
January 2020 (1)
December 2019 (1)
November 2019 (2)
October 2019 (2)
September 2019 (2)
August 2019 (2)
July 2019 (2)
June 2019 (2)
May 2019 (1)
April 2019 (0)
April 2019 (1)
March 2019 (1)
February 2019 (1)
January 2019 (1)
December 2018 (1)
November 2018 (2)
October 2018 (4)
September 2018 (4)
August 2018 (2)
July 2018 (2)
June 2018 (2)
May 2018 (1)
April 2018 (1)
March 2018 (1)
February 2018 (2)
January 2018 (1)
December 2017 (1)
November 2017 (2)
October 2017 (3)
September 2017 (3)
August 2017 (2)
July 2017 (2)
June 2017 (1)
May 2017 (2)
April 2017 (1)
March 2017 (1)
February 2017 (1)
January 2017 (2)
December 2016 (1)
November 2016 (1)
October 2016 (4)
September 2016 (5)
August 2016 (2)
July 2016 (2)
June 2016 (3)
May 2016 (2)
April 2016 (3)
March 2016 (3)
February 2016 (1)
January 2016 (2)
December 2015 (2)
November 2015 (1)
October 2015 (4)
September 2015 (5)
August 2015 (2)
July 2015 (2)
June 2015 (2)
May 2015 (1)
April 2015 (2)
March 2015 (1)
February 2015 (1)
January 2015 (1)
December 2014 (2)
November 2014 (1)
October 2014 (1)
September 2014 (2)
August 2014 (1)
July 2014 (2)
June 2014 (1)
May 2014 (2)
April 2014 (1)
March 2014 (2)
+1 800 256 3608 (toll-free North America only)