How to convert a Delimited String into an Array using OIC.

How to convert a Delimited String into an Array using OIC.

👤 Audience: Oracle Integration Cloud (OIC) Developers and enthusiasts

📘 Topic: Working with payload-to-file use cases in OIC Gen3

In real-world integrations, it’s common to receive data in a compact form -often as a comma-separated (or otherwise delimited) string. While concise, this format isn’t always convenient for downstream processing, especially when your flow expects a structured array.

With Oracle Integration Cloud (OIC) Gen 3, there’s a neat way to solve this problem using an XSLT function called:

oraext:create-nodeset-from-delimited-string(ArrayName, SourceString, Delimiter)



Business Scenario

Let’s say your REST API receives the following Delimited String payload:

{
"EmailString":"email1@gmail.com,email2@gmail.com,email3@gmail.com"
}        

We need to transform it into a structured array like this:

{
	"ArrayOfemails": [
		{
			"Email": "email1@gmail.com"
		},
		{
			"Email": "email2@gmail.com"
		},
		{
			"Email": "email@gmail.com"
		}
	]
}        

This allows downstream systems to process each email as a discrete element -ideal for looping, validations, or targeted transformations in the mapper.


Understanding the Function

The oraext:create-nodeset-from-delimited-string function takes three arguments:

oraext:create-nodeset-from-delimited-string(arg1, arg2, arg3)


arg1--> New Array Name we wanted to create
arg2--> Source Delimited String Input-
arg3--> Delimiter inside the Source String- Comma


📌 Important Note: This function must be used inside a for-each loop since it returns an array.

XSLT Mapper Implementation

Here’s how it looks in your OIC XSLT Mapper:

<xsl:template match="/" xml:id="id_11">
	<nstrgmpr:executeResponse xml:id="id_12">
		<ns16:response-wrapper>
			<ns16:emails>
				<xsl:for-each select="oraext:create-nodeset-from-delimited-string (&quot;{}ArrayofEmails&quot;, /nstrgmpr:execute/ns16:request-wrapper/ns16:EmailString, &quot;,&quot; )">
					<ns16:Email>
						<xsl:value-of select="."/>
					</ns16:Email>
				</xsl:for-each>
			</ns16:emails>
		</ns16:response-wrapper>
	</nstrgmpr:executeResponse>
</xsl:template>        
<xsl:for-each select="oraext:create-nodeset-from-delimited-string (&quot;{}ArrayofEmails&quot;, /nstrgmpr:execute/ns16:request-wrapper/ns16:EmailString, &quot;,&quot; )"> This is how we are looping the array returned from splitting the string
<ns16:Email><xsl:value-of select="."/> </ns16:Email> This maps the email address from the For each array loop

Sample Input


EmailString--->>"email1@gmail.com,email2@gmail.com,email3@gmail.com"
        

Expected Output

<ns16:response-wrapper>
	<ns16:emails>
		<ns16:Email>email1@gmail.com</ns16:Email>
		<ns16:Email>email2@gmail.com</ns16:Email>
		<ns16:Email>email3@gmail.com</ns16:Email>
	</ns16:emails>
</ns16:response-wrapper>        

Why This Matters

  • Improved Data Structure: Converts flat delimited strings into structured arrays.
  • Loop-Friendly: Ideal for iterating over values without additional parsing logic.
  • Cleaner Integrations: Keeps downstream mappings simpler and more readable.


Use Case Demo:

Showing a different Example

Article content
Trigger Request Contains the single feild contains the Demilited Email String and Target is Array Of Emails

Article content
Mapper view: Mapping Our function as source for For Loop and specifying the New Array Name and the Comma Delimiter

Article content
Mapper XSLT View

Article content
Testing in Mapper with modifying the data to see if the function is working or not
Article content
Final Test ,INput is a string and Output is an array

Final Thoughts

This approach is a clean, reusable pattern in Oracle Integration Cloud Gen 3. If you frequently deal with delimited values in REST or file-based integrations, leveraging oraext:create-nodeset-from-delimited-string will save you time and keep your mapping logic elegant.

Have you used this function in your integrations?

Drop your experiences in the comments-I’d love to hear how others are applying it in real-world OIC projects. Do comment on your way of approach to this use case.

#OracleIntegration #OIC #XSLT #IntegrationPatterns #CloudIntegration #OracleCloud


To view or add a comment, sign in

More articles by Shashikumar D.

Others also viewed

Explore content categories