Skip to main content
Administrator Guide
Last Updated: 2023-06-23
Reference: Document Accessor Helper Object

Reference: Document Accessor Helper Object

Useful Functions

Name
Arguments
Return Value Type
Notes
getData
Integer index
Source
Retrieves the document at the specified zero-based index. Use in combination with the
message.setMessage
helper function to populate the current message with the retrieved data in a memory-efficient manner.
Example: this code populates the current message with a UTF-8 XML message retrieved from the first attachment:
message.setMessage(da.getData(0), ‘text/xml’)
Results in an error if there's no integration attachment with the specified index.
String filename
Source
Retrieves the document with the specified filename. Use in combination with the
message.setMessage
helper function to populate the current message with the retrieved data in a memory-efficient manner.
Example: this code populates the current message with a UTF-8 XML message attachment with the name input.xml:
message.setMessage(da.getData(‘input.xml’), ‘text/xml’)
Results in an error if there's no integration attachment with the specified filename.
getDocumentIndexes
List<String> labels
List<Integer>
Returns a Java List of integers giving the indexes of documents tagged with all of the specified labels.
Note that if one of the labels is ‘*’ then any label is matched and the function returns all indexes for documents with at least 1 label.
getDocsMatching
List<String>
List<Source>
Retrieves documents tagged with all of the specified labels.
Workday stores documents smaller than 100 KB in memory and larger documents on disk. Be aware of runtime memory and disk space limits.
String label
Source
Retrieves documents tagged with the specified label.
Label here means integration attachment label. Synonymous with document tag.
String[] labels
Source
Retrieves documents tagged with all of the labels in the string array.
getFileName
Integer index
String
Retrieves the filename with the specified index.
String label
List<String>
Retrieves a Java List of the filenames of all the documents tagged with the specified label.
List<String> labels
List<String>
Retrieves a Java List of the filenames of all the documents tagged with the specified labels.
String label, integer index
String
Retrieves the nth filename of all the documents tagged with the specified label.
Functionally equivalent to this code:
da.getFileNames(label).get(index)
In most cases, you must use
da.getFileNames(label)
to find the number of matching filenames before you can use an index. The only exception is the limited case where you require the first (zero index) value.
List<String> labels, integer index
String
Retrieves the nth filename of all the documents tagged with the specified labels.
Functionally equivalent to this code:
da.getFileNames(labels).get(index)
In most cases, you must use
da.getFileNames(labels)
to find the number of matching filenames before you can use an index. The only exception is the limited case where you require the first (zero index) value.
String[] labels, integer index
Retrieves the nth filename of all the documents tagged with the specified labels.
Functionally equivalent to this code:
da.getFileNames(java.util.Arrays.asList(labels)).get(index)
In most cases, you must use
da.getFileNames(labels)
to find the number of matching filenames before you can use an index. The only exception is the limited case where you require the first (zero index) value.
hasFile
String filename
Boolean
Determines whether there's an integration attachment with the specified filename.
String label, String filename
Boolean
Determines whether there's an integration attachment with the specified filename and tagged with the specified label.
List<String> labels, String filename
Boolean
Determines whether there's an integration attachment with the specified filename and tagged with all of the labels in the list.
sort
String order
None
Sorts the attached documents by filename. Valid order values are:
  • "FILENAME_ASCENDING"
  • "FILENAME_DESCENDING"
Any attachments with no filename place last.
size
None
Integer
Returns the number of attached documents.
List<String> labels
Integer
Returns the number of documents tagged with all of the specified labels.
String label
Integer
Returns the number of documents tagged with the specified label.
String[] labels
Integer
Returns the number of documents tagged with all of the labels in the string array.
toVar
Integer index, String var_name
MessageVariable
Retrieves the document at the specified index and places it in a memory-efficient manner into the specified assembly variable.
Example:
da.toVar(0, ‘myInputDocument’)
String filename, String var_name
MessageVariable
Retrieves the document with the specified filename and places it in a memory-efficient manner into the specified assembly variable.
Example:
da.toVar(‘WorkerData.xml’, ‘myInputDocument’)