Repeat instruction

Looping is the most important functionality in the template language and determines where the documentation engine attaches its data source. In essence, the looping statement opens a dataset specified by a query string, and then iterates each record within the dataset. All the text contained within the loop will be repeated for every record returned by the specified query.
The basic layout of the looping statement is as follows:
##Repeat.n(RepeatType: Query) ... Text to be repeated ... ##EndRepeat.n
The looping statement consists of an opening and closing denominator, with the
##Repeat
determining the beginning and the
##EndRepeat
statement defining the ending of the block of text to be repeated. For every
##Repeat.n
statement, there
must
be a corresponding
##EndRepeat.n
statement.
Repeat Block Structure
Statement Breakdown
Description
##Repeat
This instruction informs the documentation that the current line denotes the start of the loop.
n
Specifies the nesting level of the repeat statement. This is used to attach substitution links.
Repeat Type
This is the type of loop being performed, the repeat type determines which data source is used to execute the repeat block.
Query
This is the query string used to filter the resulting dataset that is then iterated by the repeat statement.
##EndRepeat
This instruction informs the documentation that the current line denotes the end of the loop.
OrderBy
(Optional)This instruction allows the values returned in a ##Repeat statement based on the provided query to be sorted in ascending or descending order. See
Types datasets
for available fields. The sort order can be controlled by specifying
asc
for ascending order or
desc
for descending order.
Repeat Types
Repeat Type
Data Source
Description
Object
Typed Dataset
All object instances matching the query.
SubObject
Typed Dataset
All sub object instances matching the query of the object instance currently iterating.
SubObjectAll
Typed Dataset
All sub object instances matching the query.
ObjectReferences
Typed Dataset
All objects referencing the instance specified in the query.
Collection
Collection Dataset
All collection items of the currently iterating object or subobject matching the query.
CollectionAll
Collection Dataset
All collection items of all objects matching the query.
SQL
Raw SQL dataset
All items (rows) returned by the query.
SubObject and Collection repeat types are only valid when directly nested under other specific repeat types.
  1. SubObject
    Must be directly nested under an Object repeat type.
  2. Collection
    Must be directly nested under either an Object, SubObject or SubObjectAll repeat type.
When using the previous two repeat types, care must be taken to
ensure
that the nesting levels follow numerically, that is, the statements are
directly nested
.
Object, SubObject and SubObjectAll Queries
When querying a typed dataset, the following tables list the available operators that may be used to build the query statement.
Binary computational operators
Operator
Description
*
Multiply.
/
Divide.
%
mod
Modulo.
+
Add.
-
Subtract.
&
String Concatenate.
Unary logical operators
Operator
Description
!
-
Not
Logical Not.
Binary logical operators
Operator
Description
=
==
Equals.
!=
Not equals.
<>
Not equals.
>
Greater than.
>=
Greater than and equal To.
<
Less than.
<=
Less than and equal to.
&&
and
Logical And.
||
or
Logical Or.
Ternary logical operators
Operator
Description
?:
Logical If.
Object Reference Queries
Object reference queries are designed to filter objects and subobjects referencing each other. This is achieved in ACM by declaring a parameter or subparameter (parameter on a subobject) as a Reference and then referencing the objects to each other.
The syntax for this query type is as follows:
##Repeat.n(ObjectReferences: ReferenceType = "id")
Object References query reference types
Reference Type
ID
ObjectRef
Object ID. The query will return all objects referencing this ID.
SubObjectRef
SubObjectID. The query will return all parent objects of subobjects referencing this ID.
Collection Dataset Queries
There is only one possible query on collection datasets:
Name = "CollectionName"
Raw SQL Queries
There is no predefined syntax for raw SQL queries. When executing these repeat types, the documentation engine passes the SQL query straight through the project database. Any valid SQL statement may be entered.
Important
: SQL statements must me entered on a single line within the template, that is, no line-breaks may be present within the SQL statement.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal