Accessing data in data collections
Process list and map variables
are referenced in XPath expressions by name in the same way that
other types of variables are referenced. However, to access specific
data items in list and map variables,
you also need to indicate which data item in a list or map variable
you want to set or access.
To reference an entire list variable,
you use the name of the list variable. For example,
to copy all of the data from a list variable named original_list to
a list variable named copy_list,
the XPath expression that you use to reference original_list is /process_data/original_list.
indicate the data item in a list variable, you
need to specify the index position of the item. For example, a process
stores document data in a list variable named listofdocs.
You can use the execute operation of the Set Value service to retrieve
the first document in the list and save it in a document variable
named firstdoc. The XPath expression that returns
the first document in the list is /process_data/listofdocs.
Note: Indexes for list variables are
1-based so that the first item in the list has an index of 1.
Note: When saving the results of service operations
in list variables, the returned data items are
appended to the list after any existing items. To replace the items
in a list, you specify the index of the first item (for example, /process_data/listVar).
To reference an entire map variable,
you use the name of the map variable. For example,
to copy all of the data from a map variable named original_map to a map variable
named copy_map, the XPath expression that you use
to reference original_map is /process_data/original_map.
indicate the data item in a map variable, you need
to specify the key for the key-value pair. For example, a process
stores names and email addresses in a map variable
named varmapofemails. Names are used as the key,
and the email addresses are the corresponding values. You can use
the execute operation of the Set Value service to retrieve Tony’s
email address and store it in a string variable
named tonyemail. The XPath expression that returns
the value in the map variable that corresponds
to the key of tony is /process_data/mapofemails[@id='tony'].
Note: Unlike list variables, the order
in which data items are stored in map variables
can be different each time you use the map variable.
When referencing data items in map variables, you
cannot make any assumptions about the order of the data items.