Printing

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Marianne Wyatt
Posts: 31
Joined: Tue Feb 07, 2006 3:10 pm

Printing

Post by Marianne Wyatt »

I'm trying to print using a MS Word Mail Merge. I've put the fields in as they are in my database (Example: Case.PatientLastName). I put an operation in my "Case" form as well as a menu item calling the "Create Document" operation and my MS Word doc. called "Invoice" that I want to print. It calls the MS Word doc. but does not pull in any information from the database. It just shows me the Word doc. with the template field names, no data. What am I doing wrong? I've tried reading as much of the Aware help stuff as I could. Thanks.
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Did you enclose the database fields in the <<>> tags? For example, <<Case.PatientLastName>>.
Aware IM Support Team
Marianne Wyatt
Posts: 31
Joined: Tue Feb 07, 2006 3:10 pm

Post by Marianne Wyatt »

Yes. They are enclosed in << >> and contain the object name.attribute name. The thing I'm wondering is with a Word mail merge, you have to connect to the database and table that you want to pull in data for. I cannot do this with the Aware database. Is there something I'm missing? I've set up a report and put the fields in and that worked.

What I need to do though is be able to print a bunch of invoices at one time. So, if I have 10 things to be invoiced in the database, I need to be able to have the user click a button and create something like a Word mail merge and have it create 10 pages, one for each invoice that can be printed.

Can this be done?
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Marianne,

>The thing I'm wondering is with a Word mail merge, you have to >connect to the database and table that you want to pull in data for. I >cannot do this with the Aware database

With Aware IM you do not need to connect to the database and database tables - it does that automatically for you. It sounds like you are doing something wrong here but so far I can't understand what specifically. This is what you need to do to get Aware IM work with Word documents. Let me know whether you've done all this:

1) Define a document template and import Word document that contains references to attributes enclosed in tags
2) Make sure the type of the document template is MS Word. In your case you also need to tick that the data for the template is determined at run time.
3) You need to define an operation that creates document from a document template. You have to make sure that objects mentioned in the tags of the document are in the Context when the operation is invoked.

If you have done all this I am pretty sure it will work fine. If you still have problems you could e-mail your configuration to [email protected] as a BSV file and explain what specifically does not work - it will be then easy for us to tell you where the problem is.

>What I need to do though is be able to print a bunch of invoices at one >time. So, if I have 10 things to be invoiced in the database, I need to be >able to have the user click a button and create something like a Word >mail merge and have it create 10 pages, one for each invoice that can >be printed.

If every invoice is represented by a document template Aware IM will create one document per invoice, not one big file with 10 invoices, which you will then have to split manually. If you do want one file (for example, if this is all to one customer) you may consider having 10 invoice items in one invoice - in this case you may be better off creating a report rather than Word documents. If you want 10 different files then the simplest thing is to write a simple process like this:

FIND query that finds invoices
PRINT DOCUMENT 'name of the template'
or
EXPORT DOCUMENT 'name of the template' name of the directory or file
Aware IM Support Team
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

Here is an alternative idea to create a single document with multiple unrelated invoices in it - pretty much as you would get with the Word mail merge. It involves two Word-type templates in Aware IM. The first, say called Invoice, would include all the tags relevant to the Invoice object, for example:

Invoice Number: <<Invoice.Number>>
Customer: <<Invoice.Customer.Name>>
...

The document template should end with a page break.

The other template, say called New Invoices, includes a single tag, which would retrieve all the invoices required to be printed and insert the individual invoices (generated using template Invoice) into the final document. This example assumes the invoices to be printed are those with the current date. You can change the query as required:

<<SUB_DOCUMENT('FIND Invoice WHERE Invoice.IssuedOn = CURRENT_DATE ORDER BY Invoice.Number', 'Invoice')>>

Since the document includes its own query to find the required objects, it does not need an initial context and can be started, for example, from a menu item as an operation to create document New Invoices.

The generated file will be available for download through the web browser and can be subsequently printed on any printer available to the user.

The added benefit is that the template Invoice can be re-used to print a single invoice, for example as an operation on the Invoice object form.

Note that for both templates you should select the 'data is determined at run time' option when creating them in the Configuration Tool.
Aware IM Support Team
Marianne Wyatt
Posts: 31
Joined: Tue Feb 07, 2006 3:10 pm

Post by Marianne Wyatt »

Thanks for the suggestions. I did do #s 1-3 below. I'm going to undo what I did and start over. I know I'm doing something wrong so I just need to figure out what it is. I'll get back to you probably in a day or so and let you know how it goes. Thanks for the help!
Marianne Wyatt
Posts: 31
Joined: Tue Feb 07, 2006 3:10 pm

Post by Marianne Wyatt »

I wanted to give you an update. I checked the Word document and what happened was that I was using the << and >> that Word automatically puts in when you insert a mail merge field. I had previously used this Word document in another application that used the mail merge so the document was already created. These characters are not the ones that are supposed to be used. I modified the characters and it pulled in the data fine. It seems I'm on my way. I'm going to be working on doing the multiple invoices shortly and I'll let you know how that goes. Thanks for your help!
Marianne Wyatt
Posts: 31
Joined: Tue Feb 07, 2006 3:10 pm

Status on Printing

Post by Marianne Wyatt »

I created a report (Non MS Word) and it works great. It also works with the 1:M or multiple reference attributes with the embedded report. Here is the outstanding issue. I still cannot get it to print multiple invoices. If I have 10 invoices that need to be printed, I need to be able to print them at one time. I've tried creating 2 Word docs., one with the tags and one with the query and I can this error:

Error
Operation error. Document template requires data, but the data source is not provided.

I've tried it with reports and Word docs. and cannot get it to work. Do you know this error off hand? Thanks!
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

How do you invoke the operation that fills out documents from the user interface? Is it an operation on a form or a menu item or a process?

Also, can you check the output of the Aware IM server - are there any error messages there?
Aware IM Support Team
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

We reproduced this problem in a situation when the operation is invoked from a menu item of the Create Document type. Is this what you are doing as well?

If so, I can suggest a work around - wrap this operation in a process and then start a process from the menu. The process can have one action only:

DISPLAY DOCUMENT 'template name'

(or EXPORT DOCUMENT if you want it in a file)
Aware IM Support Team
john
Posts: 113
Joined: Tue Jul 25, 2006 10:48 am
Location: UK

Post by john »

Hi

I thought it best to join this topic rather that start a new one. The reply:

Did you enclose the database fields in the <<>> tags? For example, <<Case.PatientLastName>>

quoted above

Does this work with html documents also. I believe I am trying to accomplish something similar. I need to create a printer friendly version of one of my imput forms as a hard copy of this will be required. I have made a basic html page with a table containing several columns. Each column has for example <<CreditChecks.CreditCheckID>>. The information however is not picked up from the database.

Is this different for html documents, if so do you have any pointers on what I am trying to accomplish?

Best Regards
John
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

Your tag in the HTML template file should be entered like this:

<<CreditChecks.CreditCheckID>>

so that if you open the HTML template file in a web browser it will be shown like this:

<<CreditChecks.CreditCheckID>>
Aware IM Support Team
john
Posts: 113
Joined: Tue Jul 25, 2006 10:48 am
Location: UK

Post by john »

Hi

Sorry to be a pain but I must be doing something wrong here because its still not working.

I have created a document and said it is to be defined at run time (so it picks up the currently displayed item).
I have created my tags the same as above so when I open the page in a browser they show correctly and I have imported the html document. When I run the app the correct ducument is displayed but the tags show <<CreditChecks.CreditCheckID>> still.

Is there something else I need to do?

Thanks
John
aware_support2
Posts: 595
Joined: Sun Apr 24, 2005 2:22 am
Contact:

Post by aware_support2 »

This probably happens because there is no instance of CreditChecks available in the context. How/where do you invoke this document? What does the Log Viewer show?

Generally, you can invoke a document as an operation on an object form (the object instance will be available in the contents) or from a process that puts an instance in the context using actions CREATE or FIND. As an example, please have a look at document 'Payment receipt' in the Library sample application, which is invoked from process 'Register Payment'.
Aware IM Support Team
john
Posts: 113
Joined: Tue Jul 25, 2006 10:48 am
Location: UK

Post by john »

Hi

The Document opened from the "Operations Invoked From The Form" section on the actual form, so I assumed the current object would be in the context (if that makes sense).

The operation type is "Create Document" and I have selected the correct document. The document is displayed but the information is not. I get the impression from your last message that this is the correct way to do it.

The log didnt really say much but I will try it again and have another look

Thanks
John
Post Reply