Skip to main content
Version: 8.1

Vision - Template Repeater

Component Palette Icon:

The Template Repeater repeats instances of templates any number of times. It can arrange them vertically, horizontally, or in a "flow" layout, which can either be top-to-bottom or left-to-right. If there are too many to fit, a scrollbar will be shown. This makes it easy to quickly create screens that represent many similar pieces of equipment. It also can be used to create screens that are dynamic, and automatically configure themselves based on configuration stored in a database or tag structure. When first dropped on a window, the template repeater will look like any other empty container. To select the template to repeat, configure the repeater's Template Path property. There are two ways to set how many times the template should repeat:

  • Count - The template will be repeated X times, where X is the value of "Repeat Count". The repeat count starts at zero and increments X amount of times. Each value for X will be inserted into the custom property of the template that will be repeated. Template repeater inserts the value of X into the custom property on the template with the same name as the template repeater's "Index Parameter Name." For example, if the template has a custom property of "index" and the template repeater's Index Parameter Name is also "index," then the template will be repeated X many time with the value of X being inserted into the template's custom property called "index."
  • Dataset - The template will be repeated once for each row in the "Template Parameters" dataset. The template's custom properties with the same names as the dataset's column names will assume the values of each row of the dataset.
info

An Example of configuring the Template Repeater can be found on the Using the Template Repeater page.

Properties​

NameDescriptionProperty TypeScriptingCategory
Background ColorThe background color of the component. Can be chosen from color wheel, chosen from color palette, or entered as RGB or HSL value. See Color Selector.Color.backgroundAppearance
BorderThe border surrounding this component. Options are No border, Etched (Lowered), Etched (Raised), Bevel (Lowered), Bevel (Raised), Bevel (Double), and Field Border.
Note: The border is unaffected by rotation.

Changed in 8.1.21
As of 8.1.21, the "Button Border" and "Other Border" options are removed.
Border.borderCommon
Flow AlignmentAlignment for "Flow" layout style. Options are:
Left / Top
Right / Bottom
Center
int.flowAlignmentAppearance
Flow DirectionWhen the layout style is flow, this property controls if the components in the container flow horizontally or vertically.int.flowDirectionAppearance
Horizontal GapThe gap size to use for horizontal gaps.int.horizontalGapAppearance
Index Parameter NameA name of an integer parameter on the template that will be set to an index number.String.indexParamNameBehavior
Layout StyleControls how the repeated template instances are laid out inside the repeater. Options are listed below:
  • Vertical - Template instances are listed vertically, top to bottom. The height of each instance will match the height of the template instance's definition. Each instance will resize horizontally to match the width of the Template Repeater. If there isn't enough space to render all instances in the Template Repeater, a scroll bar will appear on the repeater.
  • Horizontal - Templates are listed horizontally, left to right, The width of each instance will match the width of the template instance's definition. Each instance will resize vertically to match the height of the Template Repeater. If there isn't enough space to render all instances in the Template Repeater, a scroll bar will appear on the repeater.
  • Flow - Templates are placed using the rules specified on the Flow Direction and Flow Alignment properties. The width and height of each instance will match the dimensions on the template instance's definition. If there isn't enough space to render all instances in the Template Repeater, a scroll bar will appear on the repeater.
  • BestFit - Template positioned are determined automatically by the component. All instances will be resized so they are viewable on screen. In cases where a large number of instances are configured within the repeater, this mode can negatively impact readability by resizing the instances to the point where text on each instance becomes difficult to read.
int.layoutStyleAppearance
Marquee ModeTurn the repeater into a scrolling marquee.boolean.marqueeModeBehavior
NameThe name of this component.String.nameCommon
QualityThe data quality code for any Tag bindings on this component.QualityCode.qualityData
Repeat Behavior"Count" will repeat the template a number of times, assigning each template an index number.
"Dataset" will repeat the template once per row in the template parameter's dataset.
int.repeatBehaviorBehavior
Repeat CountThe template will be repeated this many times, if the repeat behavior is set to "Count."int.repeatCountBehavior
Scroll DelayThe time (in milliseconds) to wait between performing each step in a scroll.int.scrollDelayBehavior
Stay DelayThe time (in milliseconds) to wait between scrolls.int.stayDelayBehavior
Template ParametersThis dataset will be used to control the number of templates and the parameters set on the templates if the repeat behavior is set to "Dataset."Dataset.templateParamsBehavior
Template PathThe path to the template that this container will repeat.String.templatePathBehavior
Vertical GapThe gap size to use for vertical gaps.int.verticalGapAppearance
VisibleIf disabled, the component will be hidden.boolean.visibleCommon

Scripting​

See the Vision - Template Repeater Scripting Functions page for the full list of scripting functions available for this component.

Event Handlers​

Event handlers allow you to run a script based off specific triggers. See the full list of available event handlers on the Component Events page.

Customizers​

Examples​

Code Snippet: getLoadedTemplates()
#This script will call getLoadedTemplates() on a Template Repeater, and
#then print the text property of a Label component in each instance

#Store a reference to the Template Repeater component in a variable
repeater = event.source.parent.getComponent('Template Repeater')

#Store the list of templates in another variable
templateList = repeater.getLoadedTemplates()

#Iterate through the list
for template in templateList:
#find a component named "Label" in the instance,
#and print the value of the text property
print template.getComponent('Label').text