Tuesday, April 19, 2022

Oracle Integration Cloud | Merge two CSV files into a single file without any primary key or common field

Use Case: Here, we will Merge the content of two files into one csv file where there is no common field.

Consideration: we will map the two files sequencially. That means, for 1st row of file1 to 1st row of file2, 2nd row of file1 to 2nd row of file2......nth row of file1 to nth row of file2.

For example,









Merged file:




Highlevel steps:

  1. Create a scheduled orchestration with a name.
  2. Drag and drop the FTP adapter and read both the source files one by one.
  3. Drag and drop the FTP adapter to write the final merge file. Here, in the map, for each file1 record, we will create a variable named "i" with value "position()" and that postion we will use to fetch the value from file 2 hsing $i.
Steps in detail(with screenshots):

Integration flow

Read file1

Read file2

Write Merge file

Map codes:

<xsl:template match="/" xml:id="id_11">

<nstrgmpr:WriteFile xml:id="id_12">




<xsl:value-of select="'Fname'"/>



<xsl:value-of select="'Lname'"/>



<xsl:value-of select="'Email'"/>



<xsl:for-each select="$readFile1/nsmpr1:SyncReadFileResponse/ns21:FileReadResponse/ns22:File1RecSet/ns22:File1Rec">

<xsl:variable name="i" select="position()"/>



<xsl:value-of select="ns22:FirstName"/>



<xsl:value-of select="ns22:LastName"/>



<xsl:value-of select="$readFile2/nsmpr2:SyncReadFileResponse/ns25:FileReadResponse/ns24:File2RecSet/ns24:File2Rec[$i]/ns24:EMail"/>







No comments:

Post a Comment

Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...