Filtering Report Data from Java source

G'day all

I have been using the technique for printing reminder labels as described at http://www.openvpms.org/forum/reminder-send-logic in the "One final trick" paragraph.  However, we have many customers with multiple patients requiring vaccination at the same time, eg farmers with half a dozen dogs.  The report as designed prints one record per patient, yet labels only require one label per customer.  The data source seems to be from a java source.  The existing Filter Expression is $F{reminderCount}<3.

Can this filter be extended to select only one label per customer?  Or is there another method?  I have tried a few things with changing the Filter Expression, but to no avail.  I could write a SQL query to do the job, but a quick addition would be better than a re-write.

Simon

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Filtering Report Data from Java source

Simon - the report that we use in Hong Kong is attached. This (because this is the way the practice manager wanted it) prints one label per patient with up to 5 reminders per patient (+"more") if there are more than this. It prints like:

'Kelly' is the patient name, 'Cheung' the customer name.

The attached template is set as follows:

Regards, Tim G

AttachmentSize
ReminderLabels-BE-1.jrxml 10.87 KB

Re: Filtering Report Data from Java source

Thanks Tim,

This is basically what we have, apart from sort order etc, and we use custid to match with the printed reminder document.  Putting the required vaccination is a nifty idea.  Yours still prints multiple labels per person though.  Running your template, we would still be wasting 14 labels on the first page alone (1 with 1 cat & 2 dogs, 1 with 4 dogs and 1 with 10 dogs).  Over time, this has run into a lot of wastage!

I could re-do the query in SQL, but I was hoping that there might be a quicker solution using a Filter Expression in Jaspersoft, or some other java trick (Java is still a bit of a mystery for me).

Simon

Simon Slater

Registered Linux User #463789 @ http://linuxcounter.net

Re: Filtering Report Data from Java source

Simon - we have never experimented with grouped reminders, but this may help you. That is, this generates 1 document per customer - the trick will be to handle multiple patients with multiple reminders on the one label.

Regards, Tim G

Re: Filtering Report Data from Java source

That's a good thought, I'll proceed that way.

Regards

Simon Slater

Registered Linux User #463789 @ http://linuxcounter.net

Re: Filtering Report Data from Java source

Got it sorted.  I had everything in a single detail section.  After considering your report, Tim, for the basic label we need at the moment, I just created a group on customer name, moved name, address and id into the group header and all is well.

One puzzling thing though, Column Print Order must be vertical to fill a page of labels.  With everything in the detail band and the Column Print Order as Horizontal, the entire page fills left-to-right then top-to-bottom.  Using the group, this setting fills only the left column.  Setting the Column Print Order to Vertical, as your layout has it set, fills the entire page.

I couldn't find anything in the Jaspersoft guides to explain this behaviour.  Any ideas?

Simon Slater

Registered Linux User #463789 @ http://linuxcounter.net

Re: Filtering Report Data from Java source

Simon - I must admit that the approach I take to Studio (and iReports) is 'experiment yourself' rather than 'read the manual' - though an occasional google also helps. I just found that in most cases the manual did not address my problem.

That particular reminder label report was a significant piece of work to keep the label alignment irrespective of how many reminders there were - it was by no means a quick job to build and get working properly.

Regards, Tim G

Re: Filtering Report Data from Java source

I see yours has a lot of expressions in there.  I took the easy way out - 1 band set to the label height and nothng allowed to stretch.

The Jaspersoft forums and tutorials are often useful.  But haven't looked there for the Column Print Order yet since my tinkering got the pages filled.  Maybe over the weekend.

Have a good one!

Simon Slater

Registered Linux User #463789 @ http://linuxcounter.net

Syndicate content