Table of Contents

Search

  1. Preface
  2. Understanding Data Types and Field Properties
  3. Designing Processes
  4. Using and Displaying Data
  5. Designing Guides
  6. Designing Process Objects
  7. Designing Service Connectors
  8. Using Connectors
  9. System Services, Listeners and Connectors

2. Design

2. Design

Using Functions

Using Functions

You can use the following functions when working with XQuery in Process Designer or in any fields that use a formula to set a value.
For information on XQuery functions that are available in the Formula Editor but are not described below, see http://www.xqueryfunctions.com/xq/alpha.html.
For information on using the Formula Editor to work with these functions, see Using the Expression Editor

Atomic Values of All Types

The following functions are supported in
processes
and service connectors:
  • boolean
  • empty
  • exists
  • false
  • nilled
  • not
  • number
  • string
  • true

Attachments for Processes and Service Connectors

The functions described in the following table are available for handling attachments in processes and service connectors.
In case of a process, the
$cid
value in the attachment functions refers to the process field (Input, Output or Temp). For example, if the input parameter is called customerPhoto (of type attachment), to get the attachment size, use:
sff:GetAttachmentSize($input.customerPhoto)
Be sure that your field names do not have spaces so they can be easily referenced in XQuery.
For more examples of using the attachment functions, see Attachments.
Function
Syntax
Description
Availability
base64EncodeAttachment
sff:base64EncodeAttachment($cid as xs:string?)
Indicates base64-encoded attachment contents.
Processes and service connectors
createAttachmentFromBase64
sff:createAttachmentFromBase64 ($contentName as xs:string, $encodedContent as xs:string, $mimeType as xs:string)
Creates an attachment from the base64-encoded content.
Processes and service connectors
getAttachmentCidByIndex
svc:getAttachmentCidByIndex($index as xs:integer?,)
Returns the $cid value of a response attachment by its index.
Service connectors only
getAttachmentCidByName
svc:getAttachmentCidByName($name as xs:string?,)
Returns the $cid value of a response attachment by its name.
Service connectors only
getAttachmentContentType
sff:getAttachmentContentType($cid as xs:string?)
Returns the content-type.
Processes and service connectors
getAttachmentCount
sff:getAttachmentCount($cid as xs:long)
Returns the number of attachments.
Processes and service connectors
getAttachmentName
sff:getAttachmentName($cid as xs:string?)
Returns the attachment (file) name if available.
Processes and service connectors
getAttachmentProperty
sff:getAttachmentProperty($cid as xs:string?, $attribute as xs:string)
Returns the attachment attribute, given the mime header name such as 'content-type'.
Processes and service connectors
getAttachmentSize
sff:getAttachmentSize($cid as xs:long)
Returns the attachment size.
Processes and service connectors
getBase64FromAttachment
sff:getBase64FromAttachment ($cid as xs:string)
Returns base64-encoded attachment content from the variable, which has the attachment type.
Processes and service connectors
hasAttachment
sff:hasAttachment($cid as xs:boolean)
Checks if an attachment exists.
Processes and service connectors
setAttachmentContentType
sff:setAttachmentContentType($cid as xs:string, $val as xs:string)
Sets the attachment content-type.
Processes and service connectors
setAttachmentName
sff:setAttachmentName($cid as xs:string, $val as xs:string)
Sets the attachment name.
Processes and service connectors
setAttachmentProperty
sff:setAttachmentProperty($cid as xs:string, $attribute as xs:string, $val as xs:string)
Sets the attachment mime header attribute value.
Processes and service connectors

Dates and Times

Process Designer supports most built-in XQuery date and time functions described at http://www.xqueryfunctions.com/xq/alpha.html, in addition to the following:
Function Name
Syntax
Description
now
date:now()
Returns the current time in milliseconds.
millisToDate
date:millisToDate($millis)
Converts the current time from milliseconds.
dateToMillis
date:dateToMillis($date)
Converts the time to milliseconds.
getLocale
date:getLocale()
Return a string representing the current locale the process is running in.
getTimeZone
date:getTimeZone()
Returns a string that is the timezone ID of where the process is executing or where the user is executing it.

Digital Signatures

The functions described in the following sections are available for use in digital signatures.

HMAC Functions

The following functions enable you to generate a digital signature by calculating a keyed-hash message authentication code (HMAC):
Function
Syntax
Description
hmacSignature
dsig:hmacSignature( $data as xs:string, $key as xs:string, $algorithm as xs:string, $encoding as xs:string? ) as xs:string
Generates an HMAC signature using the specified algorithm such as HMACSHA256 or HMACSHA512 and the optional encoding where
$encoding
is one of the following values:
  • Base64 (default)
  • Base64Url
  • Hex
  • Hex64
hmacSHA1signature
dsig:hmacSHA1signature( $data as xs:string, $key as xs:string, $encoding as xs:string? ) as xs:string
Calculates an HMAC using the SHA1 algorithm and the optional encoding where
$encoding
is one of the following values:
  • Base64 (default)
  • Base64Url
  • Hex
  • Hex64
$data
consist of four parts, including a JSON string in base64 encoding.
To ensure that you get hex binary and not base64 when you use the
hash:hash
function on the payload, use the following expression:
let $md5hex := hash:hash($jsonPayload,"MD5") return xs:base64Binary(xs:hexBinary($md5hex))
hmacSHA256signature
dsig:hmacSHA256signature( $data as xs:string, $key as xs:string, $encoding as xs:string? ) as xs:string
Calculates an HMAC using the SHA256 algorithm and the optional encoding where $encoding is one of the following values:
  • Base64 (default)
  • Base64Url
  • Hex
  • Hex64
hmacSHA512signature
dsig:hmacSHA512signature ( $data as xs:string, $key as xs:string, $encoding as xs:string?) as xs:string
Generates an HMAC SHA512 signature using the optional encoding where
$encoding
is one of the following values:
  • Base64 (default)
  • Base64Url
  • Hex
  • Hex64

Key Signing Functions

The following functions enable you to generate digital signatures based on private keys:
Function
Syntax
Description
signWithKeyFile
dsig:signWithKeyFile( $messageToSign as xs:string, $pathToKey as xs:string, $encryptionAlgorithm as xs:string, $digestAlgorithm as xs:string, $encoding as xs:string ) as xs:string
Generates a signature using an asymmetric algorithm and a private key, specified in a PKCS8 file.
Arguments:
  • $digestAlgorithm: SHA1 or SHA256
  • $encryptionAlgorithm: RSA (common) or DSA (if using SHA1 for $digestAlgorithm).
  • $pathToKey: The PKCS8 certificate as a Base64-encoded string (-----BEGIN PRIVATE KEY----- ..... n-----END PRIVATE KEY-----\n) or a binary private key file.
  • $encoding
    (optional), which may be:
  • Base64 (default)
  • Hex64
  • Base64Url
signWithKeyString
dsig:signWithKeyString( $messageToSign as xs:string, $key as xs:string, $encryptionAlgorithm as xs:string, $digestAlgorithm as xs:string, $encoding as xs:string ) as xs:string
Generates a signature using an asymmetric algorithm and a private key, specified in a PKCS8 certificate encoded string.
Arguments:
  • $digestAlgorithm: SHA1 or SHA256
  • $encryptionAlgorithm: RSA (common) or DSA (if using SHA1 for $digestAlgorithm).
  • $key: The PKCS8 certificate as a Base64-encoded string (-----BEGIN PRIVATE KEY----- ..... n-----END PRIVATE KEY-----\n) or a binary private key.
  • $encoding
    (optional), which may be:
    • Base64 (default)
    • Hex64
    • Base64Url
signWithCertificate
dsig:signWithCertificate( $messageToSign as xs:string, $pathToCertificate as xs:string, $keyRecoveryPassword as xs:string, $encryptionAlgorithm as xs:string, $digestAlgorithm as xs:string, $encoding as xs:string $keyStorePassword as xs:string, $aliasName as xs:string, $keyStoreType as xs:string ) as xs:string
Generates a signature using a PKCS12 certificate.
Arguments:
  • $pathToCertificate: File location on the agent that contains either a PKCS12 or JKS (Java keystore) certificate.
  • $keyRecoveryPassword: Password to access the key in the certificate.
  • $keyStorePassword: Password to open the key store. If empty, assumes the keystore is not password-protected.
  • $aliasName: Optional. Alias of entry in the keystore on the Secure Agent which contains the key. If the alias is not supplied (or empty), the first entry is used.
  • $keyStoreType: Type of keystore, which may be:
    • PKCS12 (default)
    • JKS (Java keystore)

Hashing Functions

The following functions enable you to generate a message hash string:
Function
Syntax
Description
hash
hash:hash($string, $alg)
Generates a hash string for a message using the specified algorithm (optional), where $alg is one of the following:
  • MD5 (default)
  • SHA1
  • SHA256

List Functions

The following functions allow you to work with lists:
Function
Syntax
Description
append
list:append($objectlist, $newItem)
Appends a new item to a list.
count
list:count($objectlist)
Counts the items in a list.
head
list:head($objectlist)
Returns the first item in a list.
list
list:list($sequence)
Converts a sequence of IDs into a semicolon-separated list of IDs for an object list.
remove
list:remove($objectlist, $position)
Removes the item at the specified position from the list.
replace
list:replace($objectlist, $position, $newItem)
Replaces an existing item in a list with a new value.
sequence
list:sequence($objectlistFieldName)
Converts a semicolon-separated list to a sequence.
When an object list field is inserted into formula and content, the field is wrapped in the list:sequence(object_field_name) XQuery function. For object lists in hosted objects, this converts the semicolon-separated list of IDs in the object list into a sequence. For object lists for process objects, the value is already a sequence and the function returns the list unchanged.
tail
list:tail($objectlist)
Return all items from the list with the exception of the first item.

List Function Examples

Perhaps the most common example of using the liste functions is to get an object from a list each time a step is invoked, possibly from within a repeated Process or
Service
step. For example:
LET mylist.Current:=list:head(mylist.List) LET mylist.List:=list:tail(mylist.List)
The following example converts an object list in a semicolon-separated list, then iterates over each item:
for $objectid in list:sequence($objectlist) ...
The following example converts a sequence of IDs into a semicolon-separated list of IDs for an object list for hosted objects. For an object list for process objects, it returns a sequence of values:
let $mergedObjectLists := ( as:sequence($objectlist1), as:sequence($objectlist2) ) return list:list($mergedObjectLists)

Math

In processes and service connectors, you can use the math functions described at http://www.w3.org/2005/xpath-functions/math.

Miscellaneous

The following miscellaneous functions are available:
Function
Syntax
Description
base64Decode
util:base64Decode()
Returns the base64-decoded version of the input string, typically used for attachments.
base64Encode
util:base64Encode(data, charSet)
Returns a base64-encoded version of the string provided.
Default for charSet argument: UTF-8.
base64EncodeURL
util:base64EncodeUrl(str, charSet)
Returns a base64-encoded version of the string provided, safe to use in a URL.
Any "+" and "/" characters are replaced with "-" and "_". Any "=" characters are removed.
Default for charSet argument: UTF-8.
error
fn:error
Raises a custom error.
exactly-one
fn:exactly-one
Returns a sequence if it contains exactly one item, otherwise returns errors.
format
util:format(value, pattern, timezoneId, locale)
Formats string content.
Arguments:
  • value: The string being formatted.
  • pattern: A pattern describing how the value should be formatted. See Formatting Dates, Times, and Numbers.
  • timezoneId:
    Optional. The time zone ID. If you do not use a stored value (typically returned by a call to date:getTimeZone()), you can omit this argument as Process Designer will call date:getTimeZone().
  • locale:
    Optional. The locale. If you do not use a stored value (typically returned by a call to date:getLocale()), you can omit this argument as Process Designer will call date:getLocale().
If you use a locale argument but do not use a timezoneId argument, you must add the comma that would follow timezoneId. For example:
util:format("789","##00.00","",date:getLocale())
generate-random-string
util:generate-random-string(length as xs:integer)
Generates a random string of the specified length.
generateUUID
util:generateUUID()
Generates a universally unique identifier.
getCatalogResource
util:getCatalogResource()
Returns the resource based on a catalog location URL within the organization. Takes any catalog resource in the Informatica Cloud organization as its parameter and returns an element node.
To display the element data, add a wrapper function. For example:
serialize(util:getCatalogResource("project:/spi.ipd/services.xml"))
getProcessId
util:getProcessId()
Returns the process Id of the currently executing or completed process.
getUserName
util:getUserName()
Returns a string that is the login name or ID of the authenticated User running the process .
getUserSystem
util:getUserSystem()
Returns a string that is the name of the system that authenticated the user running the process.
one-or-more
fn:one-or-more
Returns a sequence if it contains one or more items, otherwise returns errors.
parseJSON
util:parseJSON(jsonStr)
Parses the provided JSON string and converts it to XML elements.
parseXML
util:parseXML(xmlStr)
Parses the provided XML string and converts it to an XML element.
random
util:random()
Returns a random number from 0 to 1.
resolveURN
util:resolveURN()
Retrieves the URN mapping for an organization.
safeNumber
util:safeNumber()
Holds a number value safely so it cannot be changed.
setProcessTitle
ipd:setProcessTitle()
Sets the title of the process.
Use this function only in Informatica Process Designer.
toJSON
util:toJSON(elements)
Converts the provided list of XML elements to a JSON string.
toXML
util:toXML(element)
Converts the provided XML element to an XML string.
zero-or-one
fn:zero-or-one
Returns a sequence if it contains zero or one items, otherwise returns errors.

Numbers

The following number functions are available in the Formula Editor:
  • abs
  • avg
  • ceiling
  • floor
  • max
  • min
  • round
  • round-half-to-even
  • sum

Sequences

The following sequences functions are available in the Formula Editor:
  • count
  • distinct-values
  • index-of
  • insert-before
  • last
  • position
  • remove
  • reverse
  • subsequence
  • unordered

String

The following string functions are available in the Formula Editor:
  • codepoint-equal
  • codepoints-to-string
  • compare
  • concat
  • contains
  • default-collation
  • ends-with
  • lang
  • lower-case
  • matches
  • normalize-space
  • normalize-unicode
  • replace
  • starts-with
  • string-join
  • string-to-codepoints
  • substring
  • substring-after
  • substring-before
  • tokenize
  • translate
  • upper-case

XML

You can add common XML functions as you build expressions. From the Formula Editor, a list of common XML functions displays in these categories:
  • XML Documents, URIs, and IDs (processes only)
  • XML Namespaces and Names
  • XML Nodes


Updated February 11, 2021