Using Database Elements Enterprise Communications Server
164 Copyright © 2009 ADTRAN, Inc. 619510003-1A
Fetch Data element
The Fetch Data element allows you to specify a data source using the Data Source Selector, and query the
data source so that the UC server fetches the data that you want.
Use a second Fetch Data element to further filter or sort the results of the first, a third to further filter or
sort the results of the second, and so on. For example, a real estate service is set up to access a database of
real estate listings. A Fetch Data element is specified to fetch all rows that match a certain price range. If
several rows are fetched that match that criterion, the call moves through the Many rows fetched connector
pin to another Fetch Data element that further searches those listings and fetches rows based on the number
of bedrooms, until it finds the single listing that matches all criteria.
Fetch Data results
• If the Fetch Data element fetches one row, the call exits from the One row fetched connector pin.
• If the Fetch Data element fetches more than one row, then the call exits from the Many rows fetched
connector pin.
• If no rows of data are fetched, then the call exits the No rows fetched connector pin.
• If any other condition exists, such as an inability to access a Data Source (such as an external database
or internal User Data Table), then the call exits the Otherwise connector pin.
Sorting data rows
A Fetch Data element can retrieve more than one row depending on the number of rows in the source, and
your filter conditions. When one or more rows are fetched, a reference to a field by another element is
always a reference to the field’s value in the current row, in the set of rows fetched. The Move Current Row
and Prompt for Current Row elements can be used to change which row is current. Immediately after a
Fetch Data or Dial for Data element is executed, the current row is the first row.
• When only one row is fetched, the first row is the single row that was fetched.
• When multiple rows are fetched, which row is first depends on whether a sort order was defined by the
Administrator.
If no sort order was defined, then the order of the rows is determined by the data source, and you should
not make any assumptions about the order. If a sort order is defined, the first row is the first row in the sort
order specified. However, if the sort field contains duplicate values, the order of rows with the same sort
Fetch Data element