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 sublayouts. A related article will capture data from repeating fields. The XML below will be used as the sample input source.
<sample-root>
<single-occurrence>
<external-value>
shared value across all IDs
</external-value>
<multiple-occurrence>
<id>100</id>
<note>first note</note>
<note>second note</note>
</multiple-occurrence>
<multiple-occurrence>
<id>200</id>
<note>sole note</note>
</multiple-occurrence>
<multiple-occurrence>
<id>300</id>
<note>note 1</note>
<note>note 2</note>
<note>note 3</note>
</multiple-occurrence>
</single-occurrence>
</sample-root>
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 multiple-occurrence
and note
items will have an Occurs
set to Many
:
Capturing data from repeating sublayouts
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 sublayouts.
When working with sublayouts that have an Occurs
setting of Many
, you'll notice that the fields within the sublayout aren't immediately available for use:
In order to access the fields within it, you will first need to use the New Layout
Type
to add a variable for multiple_occurrence
:
After the new layout type is added, you can now reference the embedded field anywhere within your Capture code - you aren't limited to solely the new When Layout Type
section. Now that the data is readily available, you can continue coding the control like a standard control.
Comments
0 comments
Please sign in to leave a comment.