Document Description instead of Document Name

Hi,

Is there a way to have a File Name Format that has the Document Description instead of the Document Name?

We use the File Name Format:

Document name - patient full name - today's date

but would like to use (if it's possible):

Document description - patient full name - today's date

Comment viewing options

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

Re: Document Description instead of Document Name

Greta - my guess is no.  The $file variable contains the file name of the content.

Hence if you have a template as follows:
  Name = Invoice
  Description = My Beautiful Invoice
  Content = Invoice 2016-12-13 R02.jrxml

then $file will contain "Invoice 2016-12-13 R02"

What you need is a new variable $template so that you can access the description as $template.description (or the name as $template.name).

Note that you can kludge what you want by renaming the content file to say "My Beautiful Invoice.jrxml" and editing the template to load this (renamed) content file.  However, this kludge will mean that you do not have the ability to record the revision/version inforrmation in the content file name.

Regards, Tim G

Re: Document Description instead of Document Name

Ok, cool. Thanks Tim.

I will just change name of the documents and make everyone get used to them.

Greta

Re: Document Description instead of Document Name

Greta - after some experimenting (which discovered that the help text was wrong) my post above should have been as follows:

Greta - my guess is no.  The $file variable contains the name of the template.

Hence if you have a template as follows:
  Name = AVC Invoice
  Description = My Beautiful Invoice
  Content = Invoice 2016-12-13 R02.jrxml

then $file will contain "AVC Invoice"

What you need is a new variable $template so that you can access the description as $template.description (or the name as $template.name).

Hence, your only (current) option is to rename your templates as required.

However, with a bit of sexy coding we can play the following trick:

It we format the template name as <part1>[!<part2>] - ie something optionally followed by an ! character and more text - eg like one of the following (we use different templates for the CC and EIAH practice locations):

  1. Estimate!CC
  2. Estimate!EIAH
  3. Estimate

 then we can extract the <part1> bit (ie 'Estimate') using the expression:

concat (substring($file,1,number(not(contains($file,'!')))*string-length($file)),
       substring-before($file,'!'), .....)

This works because if there is no ! present (ie case 3 above) then the first argument will be $file (ie 'Estimate'), and the second argument will be an empty string.

In cases 1 & 2 (where there is an ! present) then the first argument will be an empty string and the second the characters up to the !, ie 'Estimate'.

So - for what you want, the full expression for the File Name format expression is:

concat(substring($file,1,number(not(contains($file,'!')))*string-length($file)),
       substring-before($file,'!'), ' - ', $patient.name, ' ', $customer.lastName, ' - ', date:format(openvpms:get(.,'startTime'), 'd MMM yyyy'))

 

Regards, Tim G

 

 

Re: Document Description instead of Document Name

WOW! Tim, that is way above my head. But I get the end part of it.

Where do I put this into OpenVPMS. In the archetype lookup.fileNameFormat.1.0 somewhere?

 

 

Re: Document Description instead of Document Name

Greta - two possibilities:

1) create a new Lookups|File Name Format - which is what I did:

2) Edit the standard one ('Document name - patient full name - document date') to change the expression to the new one.

In your place, I would do the first (but use something else other than 'TimTest' for the name).

This will then allow you to set this new format on the templates that you select.

Remember that you will also have to adjust the template names from say 'AVC special invoice' to 'Invoice!AVC special'.

If you look at the help screen for Lookups|File Name Format - ie http://www.openvpms.org/documentation/csh/1.9/admin/lookup/fileNameFormat you will see that I have added in the sexy expression.

 

Regards, Tim G

Syndicate content