Hi Bruce,

 

Thanks for that. I have used subreports for doing nothing more than just
holding logic or for-next or do-while loops but I had not thought of using
them linked to themselves for simplified handling of fragments of
conditional data. Not being able to easily see complex concatenations is
quite annoying. I can think of many times I should have used this idea.

 

Thanks

Brian

 

 

 

 

  _____  

From: [email protected]
[mailto:[email protected]] On Behalf Of Bruce Conrad
Sent: Monday, 8 November 2010 4:33 PM
To: [email protected]
Subject: [Dataperf] new report technique

 

Hi All,

 

While working with Tony on his DP-based web site, I discovered what might be
a new technique. Just in case others have not discovered it, I would like to
share it with the group.

 

Often times, within a report, you need to have several lines of output if
some condition is met. Otherwise, you want nothing to be output.

 

The usual pattern for dealing with this situation is:

 

SET.RV:201 to be true if the condition is met

 

SET.RV:202 using a formula like

 

if rv201

  then cat.t[ a bunch of stuff, including hard returns (represented by ;1;
), and using apply.format for numeric fields ]

  else "" /* the empty string */

endif

 

include rv202 with format A0A0

 

This is very effective, but the cat.t part of the formula for rv202 can get
quite complex, and it isn't easily visible when looking at the report in the
report editor.

 

An alternative is to use a virtual subreport to the same panel and the very
same record. Then the pattern becomes:

 

SET.RV:201 to be true if the condition is met (as before) 

Virtual Subreport (to the same panel and the same (one and only one) record)

empty headers

in report body

Skip this record if rv201 is false

the same bunch of stuff, including overt hard returns, but not needing
apply.format for numeric fields

empty footers

END of virtual subreport

 

This new (to me, at least) technique allows you to easily see the lines that
will be generated when the condition is met. It is all visible when editing
the report, without having to look into the rv202 formula (which isn't used
with this technique). If the condition is not met, then no lines are
generated.

 

I hope that you may find this as useful as I have.

 

Best wishes,

Bruce

_______________________________________________
Dataperf mailing list
[email protected]
http://lists.dataperfect.nl/mailman/listinfo/dataperf

Reply via email to