AwareIM can do MS Word-like Mail Merge

Contains tips for configurators working with Aware IM
Post Reply
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

AwareIM can do MS Word-like Mail Merge

Post by tford »

With the recent thread about using BOs to help manage a large list of docs, I decided to explore if AwareIM can do Mail Merge like MS Word. I was excited to find the answer to be -- YES!

With the help of Support, I got a sample to work. Following was their notes on the topic:
This can be done using SUB_DOCUMENT function in a Word template (you can find details in the User Guide).

You need two templates. The first (master) will only contain a single tag with the SUB_DOCUMENT function in it, which will specify a query to get all necessary instances from the database, and the name of another Word template (detail) used for each found instance. The second template will have the body of the client letter (with all the necessary tags etc.) and a page break at the end.

To generate the combined Word document you can simply run the first template. The combined document will include the letters for each found client on separate pages (because of the line break at the end of the second template).

If you use a sort order for the query, the pages in the combined document will appear in the specified order. This could be useful for printing purposes.

Note that this works for instances specified in the query, not those already in the context. If you must do it for instances already in the context you can only generate a separate document for each instance.
So, here is what I did to test it:

1- Created BO Attributes Client.Name and Client.City

2- Created a Query called ClientsForMailMerge which selects instances of Client BO and sorts it by City. The is the sort order I want my final mail merge document to be in.

3- Create a Word doc called MailMergeDocDetail.doc which contains:

Name: <<Client.Name>>
City: <<Client.City>>

+ a Page break

4- Create a Word doc called MailMergeDriver.doc which contains:

<<SUB_DOCUMENT(`ClientsForMailMerge`,`MailMergeDetail`)>>

5- Create a Document Template called MailMergeDetail and import the Word doc from #3 above. Make this "Determined at run time".

6- Create a Document Template called MailMergeDriver and import the Word doc from #4 above. Make this "Determined at run time".

7- Now to test the BSV:
7a- Create several instances of Client
7b- Select Standard | Documents | MailMergeDriver

The merged Word document will now be ready to open.

Thanks to Support for the guidance!!

Tom
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

Thanks for great work by the AwareIM development team, beginning with build 1158 the process described above just became both easier & more powerful. Note that User Defined Documents (UDD) portion of this note applies only to the Developer's version of AwareIM. Many of the same concepts apply to static Word doc templates defined by a configurator in AwareIm.

Goal --to allow users to:
1) create their own Word docs (UDDs) using AwareIM attributes
2) use other UDD attributes to manage the UDD list (i.e. Categories)
3) select a UDD from a query listing all or selected UDD
4) Use a Query by Form to select which instances of a BO to merge with the UDD
5) Display the merged Word document as ONE Word doc to be printed or saved

UDDs aren't limited to the functionality described above. It's just the scenario I am documenting below to show the power of the combined new features:

1) Create a new UDD BO by clicking on Add User Defined Document Object

2) New BO: "Client" Attributes: Name & City

2) New query: "ClientsForMailMerge_UseForm" - Query of the Client BO with "Use Form" checked.

3) New process: "DisplayUDD_UsingClientForm"
a) Process input: UserDefDoc
b) Rule: DISPLAY DOCUMENT UserDefDoc.UDD_Name USING 'ClientsForMailMerge_UseForm' MERGE INTO ONE

4) New query: "UDD List"
a) Query of UserDefDoc. You can group/search by Category, etc if you add an attribute to the UserDefDoc BO.
b) Operation: "Create Word Doc" - this runs process created in #3 above



Now to use the BSV:
5) Create a Word doc that uses:

This is a sample letter
<<Client.Name>>
<<Client.City>>

6) Create a new instance of UserDefDoc and upload Word doc created in #5 above

7) Create several of instances of Client

8)Run Query "UDD List" + Click on "Create Word Doc" operation

9) You will be presented with Query by Form to select which instances of Client you want to merge into the selected Word doc.

10) Click OK and ONE Word doc should appear with the selected instance of Client. You can now save this to a Word doc, print it locally or create a PDF.

I hope I got all the steps right.

Tom
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Great summary, Tom!
Aware IM Support Team
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

One more neat improvement with build 1158 can be shown with this.

You can now place a operation with a process using ENTER NEW "above the list" & the when the user clicks on it, AwareIM will present the form in a modal window.

1) New Process: NewUDD
a) rule: ENTER NEW UserDefDoc USING Main

2) New Process: NewClient
b) rule: ENTER NEW Client USING Main

3) Add the processes from #1 and #2 as operations above to the Query: UDD List

- Location: Above the List
- Applicable to multiple items: unchecked

When you run the UDD List query now, you will be able to add UDDs and Clients while the query remains on the screen.

Tom
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

You can also use PICK FROM with UDDs as shown below.

Process with 2 rules:

1- PICK FROM 'UDD List'
2- DISPLAY DOCUMENT UserDefDoc.UDD_Name USING 'ClientsWithNoWelcomeLetter' MERGE INTO ONE

The first rule allows the user to pick the UDD they want to use.

The second performs the Query by Form to select clients for the mail merge & uses the UDD from #1 to perform the mail merge.

If anyone would like this sample bsv, just send me a PM with your email address and ask for udd2.

Tom
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Post by tford »

User access changing UDDs can happen as follows:

Image
Tom - V8.8 build 3137 - MySql / PostGres
aware_support
Posts: 7525
Joined: Sun Apr 24, 2005 12:36 am
Contact:

Post by aware_support »

Sample bsv can be found here:
http://www.awareim.com/bsv/udd2.bsv.bin

Please rename the file to udd2.bsv after you download it
Aware IM Support Team
Post Reply