Difference between revisions of "Create a Compound Document Template"
imported>Aeric |
imported>Aeric m (Text replace - 'print template' to 'Document Template') |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
A compound | A compound Document Template lets you combine multiple templates into a single output file. | ||
<noinclude>__TOC__</noinclude> | |||
Compound | ====About Compound Document Templates==== | ||
Compound Document Templates have multiple uses: | |||
:;Create a single file composed of multiple documents: | :;Create a single file composed of multiple documents: | ||
Line 8: | Line 9: | ||
:;Create a single document composed of multiple parts: | :;Create a single document composed of multiple parts: | ||
:: For example, when printing an order form, a cover page with logo images and boilerplate could be in the first section, and the logic for looping through order items could be in a second section. A designer working on the layout of the cover page could then ignore the logic, which could be reused in different templates. | :: For example, when printing an order form, a cover page with logo images and boilerplate could be in the first section, and the logic for looping through order items could be in a second section. A designer working on the layout of the cover page could then ignore the logic, which could be reused in different templates. | ||
::(See [[# | ::(See [[#Example: A Two-Part Order Form|Example: A Two-Part Order Form]].) | ||
{{Note|Every template prints on a new page, so that strategy is only useful for a multi-page invoice.}} | {{Note|Every template prints on a new page, so that strategy is only useful for a multi-page invoice.}} | ||
:;Any combination of the above: | :;Any combination of the above: | ||
:: The output of the compound document is a single file. What goes into that file is up to you. You can create any combination of documents and document components you want, using | :: The output of the compound document is a single file. What goes into that file is up to you. You can create any combination of documents and document components you want, using Document Template Variables to access information from the record you are processing, any records it looks up to, and any records that are related to it. | ||
::''Learn more:'' | ::''Learn more:'' | ||
:::* [[ | :::* [[Document Templates#Insert Images, Charts, and Template Variables|Insert Images, Charts, and Template Variables]] | ||
:::* [[ | :::* [[Document Templates#Finding and Using Related Record Variables|Finding and Using Related Record Variables]] | ||
====Working with Compound Document Templates==== | |||
'''Considerations''' | '''Considerations''' | ||
:* A compound template contains references to its component templates. So updating a component-template automatically updates all compound templates it is used in. | :* A compound template contains references to its component templates. So updating a component-template automatically updates all compound templates it is used in. | ||
:* Compound documents are always queued | :* Compound documents are always queued. An email is sent when processing is finished. | ||
:* Generated documents are saved in '''Documents > Export Data''' folder. The email contains a link. | |||
:* | |||
'''To create a compound | '''To create a compound Document Template:''' | ||
# Go to '''{object} > Customize this Object > | # Go to '''{object} > Customize this Object > Document Templates''' | ||
# Click '''[New Template]''' | # Click '''[New Template]''' | ||
# Specify '''Type''' as '''Compound'''<br>An '''[Add Template]''' button appears. | # Specify '''Type''' as '''Compound'''<br>An '''[Add Template]''' button appears. | ||
Line 35: | Line 36: | ||
:* '''Select the empty row''' at the top of the template selection field.<br>When saved, that row is removed from the compound template. | :* '''Select the empty row''' at the top of the template selection field.<br>When saved, that row is removed from the compound template. | ||
====Example: A Two-Part Order Form==== | |||
This example breaks the [[ | This example breaks the [[Document Templates#Sample Document Template for an Order Invoice|Sample Document Template for an Order Invoice]] into two parts, so that the processing logic is confined to a single module: | ||
Cover Page Component: | '''Cover Page Component:''' | ||
:<syntaxhighlight lang="xml" enclose="div"> | :<syntaxhighlight lang="xml" enclose="div"> | ||
<html> | <html> | ||
Line 96: | Line 97: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Logic Component: | '''Logic Component:''' | ||
:<syntaxhighlight lang="xml" enclose="div"> | :<syntaxhighlight lang="xml" enclose="div"> | ||
<html> | <html> |
Latest revision as of 23:36, 12 November 2013
A compound Document Template lets you combine multiple templates into a single output file.
About Compound Document Templates
Compound Document Templates have multiple uses:
- Create a single file composed of multiple documents
- When processing an order, you might need to generate an inventory-pull sheet, a customer invoice, and a shipping sheet. Each of those would be a separate template, but they can all be printed at one time in a single, compound document. (The templates can be of different types, as well. One might be a Word document, while another is an HTML template.)
- Create a single document composed of multiple parts
- For example, when printing an order form, a cover page with logo images and boilerplate could be in the first section, and the logic for looping through order items could be in a second section. A designer working on the layout of the cover page could then ignore the logic, which could be reused in different templates.
- (See Example: A Two-Part Order Form.)
- Any combination of the above
- The output of the compound document is a single file. What goes into that file is up to you. You can create any combination of documents and document components you want, using Document Template Variables to access information from the record you are processing, any records it looks up to, and any records that are related to it.
- Learn more:
Working with Compound Document Templates
Considerations
- A compound template contains references to its component templates. So updating a component-template automatically updates all compound templates it is used in.
- Compound documents are always queued. An email is sent when processing is finished.
- Generated documents are saved in Documents > Export Data folder. The email contains a link.
To create a compound Document Template:
- Go to {object} > Customize this Object > Document Templates
- Click [New Template]
- Specify Type as Compound
An [Add Template] button appears. - Click the button to add a new template to the list of components
To remove a component template:
- Select the empty row at the top of the template selection field.
When saved, that row is removed from the compound template.
- Select the empty row at the top of the template selection field.
Example: A Two-Part Order Form
This example breaks the Sample Document Template for an Order Invoice into two parts, so that the processing logic is confined to a single module:
Cover Page Component:
- <syntaxhighlight lang="xml" enclose="div">
<html> <head> <title></title> <style>
div { padding-top: 5px; padding-bottom: 5px; padding-right: 5px; padding-left: 30px; border: 3px;
margin-top: 5%; margin-right: 40%; margin-bottom: 5%; margin-left: 5%;
}
</style>
</head> <body bgcolor="#FFFFFF" text="#000000"
link="#0000FF" vlink="#800080" alink="#FF0000">
<img width="100" height="100" src="http://justanothermobilemonday.com/Wordpress/wp-content/uploads/2009/10/android-robot-logo2.jpg" alt="Company logo" /> <---- Company Logo Here
$company.name
$company.street
$company.city, $company.state,
$company.country - $company.zip
(Phone): $user.phone
Order Invoice
Invoice Date: $Orders.date_created
Bill To:
$Orders.account.name - $Orders.account.number
$Orders.account.street
$Orders.account.city, $Orders.account.state,
$Orders.account.country - $Orders.account.zip
(Phone): $Orders.account.phone
Invoice #: $Orders.order_number
</body> </html> </syntaxhighlight>
Logic Component:
- <syntaxhighlight lang="xml" enclose="div">
<html> <body>
<tbody> </tbody>- foreach( $OrderItems_record in $OrderItems )
- end
Quantity | Product | Unit Price | Amount |
---|---|---|---|
$OrderItems_record.item_quantity | $OrderItems_record.related_to_ProductInventory.product_name | $OrderItems_record.item_price | $OrderItems_record.total |
Sub Total | $Order.grid_comptn_f5631e34b39f4ba39a98559c7215a3b4 | ||
Tax | $Orders.grid_tax_f5631e34b39f4ba39a98559c7215a3b4 | ||
Shipping | $Orders.grid_shipping_f5631e34b39f4ba39a98559c7215a3b4 | ||
TOTAL AMOUNT DUE | $Orders.grid_net_total_f5631e34b39f4ba39a98559c7215a3b4 |
</body> </html> </syntaxhighlight>