Grouped Reminder Template throwing Expression and Property Errors

G'day all

I don't know if this issue is with my xpath statements or with iReports settings.  When I 'Send All' reminders of a type with the grouped reminder template, the report prints fine for owners with 1 pet, but for those with multiple pets I get Expression Error and Invalid Property errrors on some fields only. Using the 'Print' button for one reminder works fine.  The Reminder Due Date field works fine for all cases.

Grouped reminders is checked for the Reminder Type and the Template is the grouped reminder template (modified ) supplied with OP and the grouping is on $F{customer.id} .  The Template Type is Grouped Reminders and the Report Type is Patient.  The errors and associated field expressions are:

Expression Error

Owner Fist Name     $F{[openvpms:get(party:getPatientOwner(openvpms:get(.,'patient.entity')), 'firstName')]}

Invalid property

Pet Name              $F{patient.entity.name}

Reminder Type     $F{reminderType.entity.description}

No Error

Due Date     $F{endTime}

Anyone have any ideas on where the problem lies?

Regards Simon

Comment viewing options

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

Re: Grouped Reminder Template throwing Expression and ...

The grouped reminder template uses different fields compared with a standard reminder template.

Take a look at the <OPENVPMS_HOME>/reports/grouped reminders a4.jrxml for a list of the supported fields.

Re: Grouped Reminder Template throwing Expression and ...

Hi Tim,

that is the report I used to work from.  In the case of the Client's name, the default template gives 'Surname, Firstname', so my change was intended to give just firstname.

Since my expression [openvpms:get(party:getPatientOwner(openvpms:get(.,'patient.entity')), 'firstName')] returns the firstname for a report with 1 patient fine in a group header, what will it do when there are multiple patients?  If this is the cause of that field failing, shouldn't the petname and reminder type in the detail still work, like the due date does?

Regards Simon

Simon Slater

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

Re: Grouped Reminder Template throwing Expression and ...

The expression:

openvpms:get(party:getPatientOwner(openvpms:get(.,'patient.entity')), 'firstName')]

won't work as there is no patient.entity node.

The customer.name field will give you the name of the owner for the patient.

Add a customer.firstName field to get the owner's first name.

 

Re: Grouped Reminder Template throwing Expression and ...

I went right back to the original grouped reminder a4.jrxml distributed with OP and this is still giving me the same trouble (as per the screenshot) where the endTime is the only field that is working.

The fields in the jrxml file are:

    <field name="endTime" class="java.util.Date"/>
    <field name="customer.id" class="java.lang.Long"/>
    <field name="patient.name" class="java.lang.String"/>
    <field name="customer.name" class="java.lang.String"/>
    <field name="[party:getPartyFullName(openvpms:get(.,&apos;customer&apos;))]" class="java.lang.String"/>
    <field name="[party:getBillingAddress(openvpms:get(.,&apos;customer&apos;))]" class="java.lang.String"/>
    <field name="reminderCount" class="java.lang.Integer"/>
    <field name="reminderType.name" class="java.lang.String"/>
    <field name="product.name" class="java.lang.String"/>

I've been follong these fields through the adl files to understand the nodes and relationships, but still havn't got sorted yet.  The Expression Error would indicate there is something wrong with both the FullName and BillingAddress field expressions, but the Invalid property name would mean the wrong node.  Is that correct?

Simon

Simon Slater

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

Re: Grouped Reminder Template throwing Expression and ...

G'day all,

I'm doing a bit of trial-and-error now in iReport to try to understand these expressions.

Using the original grouped report, if I add these fields I get these errors when in OP  Reporting>Reminders>Print>Preview:

$F{customer.id}  gives the error "Failed to generate report: Error evaluating expression :
Source text : $F{customer.id}"

and from the Patient part of the page http://www.openvpms.org/document-merging-open-office-writer adding

$F{[openvpms:get(party:getPatientOwner(.),'id')]} gives the error "Failed to generate report: Error evaluating expression :
Source text : $F{[openvpms:get(party:getPatientOwner(.),'id')]}"

Remembering that $F{endTime} works fine, where does the report go to look for the data? From the Report Type?  That is which endTime node does it look for from $F{endTime}?  The page http://www.openvpms.org/book/export/html/5038 has an example using act.customerAppointment which also has an endTime node.

Which adl and node does $F{[openvpms:get(party:getPatientOwner(.),'id')]} retrieve?

Perhaps I need a primer on these java / xpath expressions.  Can anyone point me to one?

Simon

Simon Slater

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

Re: Grouped Reminder Template throwing Expression and ...

Reminder Types should not explicitly link to the grouped reminder template. To indicate that a reminder type can be grouped, select the Group box, as per the Reminder Type documentation.

The grouped reminder template can only be used to print grouped reminders. It cannot be used in any other setting i.e. in Administration - Templates, it must have a Type of Grouped Reminders. You cannot use it to print single reminders, hence the reason you get errors using Print -> Preview.

 

Re: Grouped Reminder Template throwing Expression and ...

Thanks Tim,

I had linked the grouped template to the reminder type.  So if grouping reminders is the intention, any template at all would do in the reminder type?

On your second point, to test the grouped template looks as it should, I either need some sample data or reset the reminder count to use the Send All option.  I expect the second option has some caveats.

Simon

Simon Slater

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

Re: Grouped Reminder Template throwing Expression and ...

The grouped reminder template will only be used when there is more than one reminder, so you will still need a valid template linked to the reminder type.

To test your template, I recommend setting up a new OpenVPMS installation. This way you can verify everything works before deploying to production, and you don't impact your production environment.

If you set it up from a production backup, you should disable email and ESCI to avoid spurious emails and orders.

Re: Grouped Reminder Template throwing Expression and ...

You could also attach your current template if you want us to check it

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Grouped Reminder Template throwing Expression and ...

Thanks Ben, here it is for your perusal.

Simon

AttachmentSize
grouped_reminders_a4.jrxml 8.64 KB

Simon Slater

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

Re: Grouped Reminder Template throwing Expression and ...

G'day all,

Thanks for the help, the reminder reports are working and off the printer, both Jasper reports and LO documents.  I realized now where I made the mistakes.

First I missed that grouped reminders are a special report ( http://www.openvpms.org/book/export/html/5038 ) and so take a different set of fields.

Second, I was making direct reference to nodes not in the adl file linked to a given report type ( other than one of the 3 special ones) and making incorrect reference, by syntax errors, to participating nodes/adls as also mentioned in the link above.

To tidy things up, 2 last questions:

1/  To remove any chance of error when physically matching reminder letters to mailing labels, I can place the customer id on the grouped reminder as well as the first and second reminder letters.  Is it possible to access the customer id from a Reminder Report Type, so the customer id can also be placed on the labels?  If so, what would the expression be?  I can't work it out.

2/  Following Note #3 in http://www.openvpms.org/book/export/html/3161 I have created a new practice location and attached the template to it, but still only have the original location in the drop-down box at the top right of the screen.  What have I missed?  At the moment I have swapped the reminder report for the mailing labels report in the original practice location and will need to swap them back.

Thanks again, Simon

Simon Slater

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

Re: Grouped Reminder Template throwing Expression and ...

Simon - Q2 first.  My guess is that you need to tweak your User record to give yourself access to the new practice location.

Q1: the following should do the trick:

[openvpms:get(party:getPatientOwner(.),'id')]

Below is a snippet showing the reminder label jrxml that we use - these get stuck on a preprinted postcard and contain up to 4 reminders down the bottom - if there are more than this for the one patient, then the bottom line says ***more***.

Note that we don't group them - each patient gets their own postcard addressed to <patient-name> <owner lastName>.

The reason we need the 'type.code' (ie the Account Type) is that the house call customers get a different postcard and for these we print CC at the bottom right of the label.

Regards, Tim G

 

Re: Grouped Reminder Template throwing Expression and ...

Tim,

Found the Location tab under user, thanks.

I had found your suggestion on this page: http://www.openvpms.org/document-merging-open-office-writer under patient document in the table.  However it throws the error:

Failed to generate report: Error evaluating expression :
Source text : $F{[openvpms:get(party:getPatientOwner(.),'id')]}

Tried it again just now to be sure and same error.

Simon

Simon Slater

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

Re: Grouped Reminder Template throwing Expression and ...

Humm - my error.  If you are running grouped reminders, then the fields available are given in http://www.openvpms.org/documentation/csh/1.7/reference/reportFields - the bit you want is at the bottom where it says:

Now the 1.8 version has been fattened up somewhat and you should gather that to get at the customer id you need customer.entity.id

The way I think of this is 'customer' points at something that is an entity hence customer.entity gives you the customer and then you add '.id' to get at the id.

customer.id does not work.

The above reference contains examples of how things work with an appointment.

Regards, Tim G

 

Re: Grouped Reminder Template throwing Expression and ...

Sorry Tim, my mistake:

I can get the customer id field in the grouped reminder and patient letter report types, it is in the Reminer Report type that I am having the trouble.

The Reminder Report uses the act.patientReminder.adl which has a participation of participation.patient.  Neither have the customer id node.

Simon

Simon Slater

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

Re: Grouped Reminder Template throwing Expression and ...

OK - I checked:

a) we have 2 templates of type Reminder Report in the system - as shown below:

However, because of the template setting in the Practice, we use the ReminderLabels one:

and looking at this template we have:

So the actual template used when you press the Report button is ReminderLabels-BE.jrxml - and that is the one I referred to in the earlier reply - so my answer remains:

[openvpms:get(party:getPatientOwner(.),'id')]

Note that from http://www.openvpms.org/documentation/csh/1.7/reference/jxpath#party we have:

Note that we can call this with any act that has a patient note - and act.patientReminder does.

Note also that because act.patientReminder does not have a customer node, we have to use party:getPatientOwner(.) to get the customer.

Now reading your post carefully - you seem to be using an odt based template rather than a jrxml based one. [I use the jrxml because I want to put multiple reminders on the one label and not generate one label per reminder.]

So if I was to use an odt document, the field is the same - the following is taken from the Sample Patient Document that ships with 1.8

So in both an odt document and a jrxml one, the field definition is identical.  However, in the jrxml one (using iReports or Studio) the text field expression is $F{xxxxxxx} where xxxxxx is the actual field - in the above case [openvpms:get(party:getPatientOwner(.),'id')].

So if you used $F{[openvpms:get(party:getPatientOwner(.),'id')]} in your odt document, I can understand it bitching.

Regards, Tim G

Re: Grouped Reminder Template throwing Expression and ...

Tim,

I actually have both jrxml and odt working for other report types, it is just this reminder report giving me trouble.

Looking at that reference, it has an example of party:getPatientOwner($visit).  So in this case $visit would be $reminder, so I tried (in iReports):

$F{[openvpms:get(party:getPatientOwner(openvpms:get(.,'reminder.act')),'id')]}

which failed with "Expression Error".  It is getting a bit late to think straight, but have I got the wrong end of the stick?  Tracing the path from act.patientReminder.adl to the customer id node in party.customerperson.adl traverses 3 other adl files.  How deep can these expressions be nested?

Simon

Simon Slater

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

Re: Grouped Reminder Template throwing Expression and ...

Simon - I took the standard Patient Reminders report and tweaked it as follows:

a. Add extra fields

 

b. Here is the field definition – note that the id is a long

c. Add the corresponding text fields to the detail band – note that I made the fields really wide so that you can see the full text expression. [Don’t worry about the red outlined stuff this is just Jaspersoft Studio bitching about the use of the depreciated pdf stuff. I am running Studio rather than iReports because ireports does not like Java 8.]

 

Here is the output: You can see that both field expressions work.

 

Regards, Tim G

Re: Grouped Reminder Template throwing Expression and ...

Thanks Tim,

The key was the field class.  I had it as string.  Changing to long works fine now.

A couple of days ago I noticed that, but thought the id wouldn't be used for calculations, so left it as a string.

All's good now, thanks again

Simon

Simon Slater

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

Syndicate content