Using the Printable Document#
Estimated time to read: 9 minutes
During the manufacturing process it may be necessary to print labels and documents. This can be achieved by using Printable Document.
The Printable Document entity is the core object of Advanced Layout and Printing, which is the module that provides the ability to design and print labels, lot travelers and other types of documents, such as Material Identification or a Certificate of Conformance.
Info
Advanced Layout and Printing is a Critical Manufacturing optional module.
This document provides step-by-step information so you can accomplish some common Printable Document scenarios.
Overview#
The Printable Document represents a generic document whose content is generated dynamically whenever it is printed, based on a context that is a combination of user inputs and automatically calculated data (including serial numbers).
It also ensures full traceability by versioning the Printable Document object and, optionally, keeping the history of each print operation including a preview of what was printed.
The Printable Document is available for every object.
Creating a Material Document#
This section describes how to create a simple document for a Material. The example will illustrate the usage of expressions and DEE Actions for calculating dynamic content.
Info
The procedure below is similar for every object type. The only difference is that for Material, printing can be initiated from the Material Details page, the Step View and the Resource View; for all other object types, the actual printing needs to initiated from the Printable Document details page.
Configure the Printer Types#
-
Add the different Printer Types to the Lookup table called PrinterType.
-
Configure the Smart Table PrinterTypePrinterContexts. This table maps the different Printer Types to specific Printers for particular users and computers.
Configure the Necessary DEE Actions#
Info
This is an optional step. The recommendation is to use DEE Actions only if it's not possible to achieve the same result using expressions or the expression editor of the layout designer.
In this example, a simple action will be used to read the attribute InspectionRate of the Material and concatenate it with the CustomerName attribute of the Material Product. The Customer Name is associated with the non-versioned portion of the Product.
Create the DEE Action#
Here is a DEE Action sample, called PrintableDocumentGetInspectionRateAndCustomer:
UseReference("Cmf.Foundation.BusinessObjects.dll", "Cmf.Foundation.BusinessObjects");
UseReference("Cmf.Navigo.BusinessObjects.dll", "Cmf.Navigo.BusinessObjects");
UseReference("Cmf.Foundation.BusinessOrchestration.dll", "");
UseReference("", "Cmf.Foundation.Common.Exceptions");
UseReference("", "Cmf.Foundation.Common");
IMaterial mat = Input["AppliesToValue"] as IMaterial;
IProduct prod = mat.Product;
//Load Attributes
mat.LoadAttributes(new Collection<String>() { "InspectionRate" });
prod.LoadAttributes();
Dictionary<String, Object> Output = new Dictionary<string, object>();
Output["Result"] = String.Format("{0}% - {1}",
mat.Attributes.ContainsKey("InspectionRate") ? mat.Attributes["InspectionRate"] : "",
prod.RelatedAttributes.ContainsKey("CustomerName") ? prod.RelatedAttributes["CustomerName"] : "");
return Output;
To make the DEE Action available for Printable Documents, it's necessary to:
-
Define the Scope Classification for DEE actions by editing the Generic Table ScopeClassifications and creating an entry PrintableDocumentContextItem
-
Create the DEE Action with the code specified above.
-
When creating the DEE action (like the one with the source code example above), set its classification to the value defined in the previous point.
-
Create a Rule object with scope PrintableDocumentContextItem and referring to the entry created in point 1.
Create the Printable Document#
-
Assuming that there is a Change Set created, create the Printable Document:
-
You can also edit the Printable Document:
Note
If your Printable Document is in the Created state, you will be able to edit more properties than when it is in the Effective state.
Info
For more information, see Create Printable Document and Edit Printable Document in the User Guide.
-
Next, in the Layout designer, edit a page layout. You may reference any property of the
$AppliesToValueentries or use the variables (PrimaryQuantity, FacilityName or TestLabel) that were used in this case. Be sure to save the layout before closing the layout editor.
Info
For more information on how to create and edit the page layout, see Printable Document Layout Creation in the User Guide.
Print the Document#
After setting the document effective, the document can be printed directly from the Printable Document details page.
In order to be able to print the document directly from the Material (in alternative, from the Step View or Resource View), it's necessary to define the context in the Smart Table MaterialPrintableDocumentContext. An example is shown in the next picture:
When selecting the Print Documents option, all Documents matching the document context will be available for the user.
Printing a Lot Traveler#
The Lot Traveler is constructed dynamically based on the next Steps and Flows of the Material.
Warning
The Lot Traveler will print the Material current Step and all the next non-Optional, non-Alternate Steps for the Area.
Warning
If a Step of the Area does not have a Lot Traveler defined, the system will try to use the default Lot Traveler document from the Smart Table AreaPrintableDocumentContext. If no default document exists, the Step will be skipped in the Lot Traveler printing.
Create the Lot Traveler#
The creation process of a Printable Document suitable for being used in a Lot Traveler is similar to the creation of Printable Document as explained above with the particularity that, it must be of type "Lot Traveler". When a Printable Document is defined of type "Lot Traveler", the Applies To property is automatically set to Material. In addition, three Data Contexts are automatically created: Step, Flow and Flow Path. Because the Lot Traveler is based on dynamic information of the Material, during runtime, the system will supply the appropriate values for these three contexts for each Step.
Associate the Lot Traveler with the Steps#
Each Step can have its own Lot Traveler document, or each Step can have its own unique Lot Traveler document. To associate a Lot Traveler with a Step, it's necessary to edit the Step and set the Step Lot Traveler property.
For convenience, it's also possible to define the Lot Travelers for a complete Area or Facility in the Smart Table AreaPrintableDocumentContext. An example is shown in the next picture:
To print the Lot Traveler (it always prints the Lot Traveler for the complete Area), it's just necessary to select the desired Material in the Step View, Resource View or in the Material details page, and then select Print Lot Traveler.
Info
By default, it only prints the Lot Traveler for all the current and next steps of the current Area. It's also possible to print the Lot Traveler for the current Step by selecting the Current Step only option on the right side of the Wizard or print the Lot Traveler for the all Facilities by selecting the All Facilities only option on the right side of the Wizard.
Info
More information on how to print a Lot Traveler or other Material documents can be found at Print Material Documents section of the User Guide.
Additional Information#
Using Entity Types in a Printable Document#
Printable Documents can be created for any entity type by defining the desired entity type as Applies To property. A print button on the entity details page appears only for Material objects and documents to be printed for a given Material are resolved using the Smart Table MaterialPrintableDocumentContext. For all other EntityTypes, printing has to be triggered from the Printable Document page.
Linking a dynamic variable to a Entity Type property#
There are two possible options:
-
Define a ContextItem for which the value is an EntityInstance (Object) and in the Document designer, link the layout field values to the desired property of that object - when the value of a ContextItem is an EntityType, the designer will show all properties of that EntityType, so any property can be used. This is also applicable to the AppliesTo property, but in this case it appears as a parameter named
AppliesToValueon the designer. -
Define a ContextItem that uses an expression to extract the value of the desired property. In this case the designer will be provided with property value directly instead of the entire Entity Instance with all its different properties. The expression for this would be in the format:
$(ParameterName).(PropertyName)[.(PropertyName)...where ParameterName is the name of the parameter holding the EntityInstance (may be another ContextItem or the$AppliesToValuespecial parameter) and (PropertyName) is the name of the desired property.
Info
If the AppliesTo refers to a Material object, you can dynamically get the Facility Name by creating a Context Item of type expression and specifying the source as $AppliesToValue.Facility.Name.
Linking a variable to an entity type attribute#
In the case of attributes it becomes necessary to use a ContextItem that is calculated using a DEE Action since the Attributes must be loaded beforehand in order to be used. This would be a very simple DEE Action that just executes LoadAttributes() on the desired entity instance (possibly coming from another ContextItem or $AppliesToValue, as the DEE Action receives all values already calculated as input) and then returns the value of the desired attribute.
String array support#
In order to support string[] types, the ContextItem would be defined as being of Type String and the Value is Collection flag must be set to True. Then the DEE Action that extracts the value of the attribute needs to convert the attribute value (which will be List<String>) to a Collection<String>.
Example:












