15. Writing a Template Assistant : How You Can Ensure Compatibility Between the Assistant and ApplyTemplate : How You Can Use ApplyTemplate on a Frame : High-level Composite Field
 
Share this page                  
High-level Composite Field
When designing a frame template for use with a frame template assistant and the ApplyTemplate utility, be sure that all form fields reside within the bounds of a high-level composite field.
A tag associated with this field is assigned to a specific macro variable defined for the frame template. The tag exists as a string value assigned to the ClientText attribute of the high-level composite field. The value of the string is equal to the value of the $_TopComposite macro variable defined for the frame template.
By evaluating the $_TopComposite macro variable for a frame template and the frame generated from it, the ApplyTemplate utility is able to identify which specific high-level composite field on the frame's form comprises the template-owned portion. By overwriting only this high-level composite, and no other, the ApplyTemplate utility can be guaranteed to not affect any user changes to the frame.
Because the high-level composite of the frame is overwritten by the corresponding high-level composite from the frame template, all of the fields generated by the frame template assistant when the frame was first created (or since the last time the ApplyTemplate utility was run) are overwritten or lost. The second function of the ApplyTemplate utility, therefore, is to regenerate the dynamic fields and queries created by the frame template assistant. This function, however, is not performed by the ApplyTemplate utility itself, but is instead performed entirely by the frame assistant, which is called from the ApplyTemplate utility.