When working with certain layout types, such as XML, it is possible to have portions of the the input source repeat multiple times.
For example, the XML below has the tag
multiple-occurrence occur three times, each with unique nested values. This is referred to as a sublayout within Infogix Assure. In addition, the
note field occasionally displays multiple times within the sublayout.
This article will demonstrate how to capture when you have repeating fields. A related article will capture data from repeating sublayouts. The XML below will be used as the sample input source.
shared value across all IDs
Setting up the Infogix Assure layout
When using auto-generate to create the layout, the repeating sublayouts and field will be automatically picked up and defined. In some scenarios where repeats are less common or not defined in a schema, the automatic generation may not pick up on it.
To verify if your layout was creating correctly, open the sublayout or field that repeats and inspect the
Occurs field. This should be set to
Many to any item that repeats.
In the XML example at the beginning of this article, the
note items will have an
Occurs set to
Capturing data from repeating fields
This section assumes that you already have an understanding on how Infogix Assure controls are created and will focus on the specific steps within a Control Point's Capture tab to pull data from repeating fields.
Note field within the XML appears a variable amount of times within each sublayout occurrence. When this field is captured within the Capture tab, it will be stored as a List. There are several possibilities of what to capture from a list. This particular example will demonstrate how to capture the last occurrence of the
The code highlighted below will dynamically determine the number of times the field is repeated and then select the last occurrence to store.
Several similar techniques can be used, such as replacing the
@list_size function with a literal of
0 to always capture the first occurrence, or a literal of
1 to always capture the second occurrence.