Skip to Content

Business Case:

In some cases, there may be a requirement to split the source message with multiple records into multiple messages (files) at the receiver (multiple files) where file name and directory name are to be determined at run time. It becomes even more peculiar when the decision to determine the file/name and directory resides in PI. 

Technical challenges:

  • Message splitting has to be take place so multi-mapping is the only solution.
  • Dynamic configuration does not work in case of multi-mapping.
  • Variable substitution is an alternate way to assign file/directory name dynamically.
  • Value assignment happens in the payload (in this example CSV format), at mapping run time and populated through the adapter at runtime.
  • Technical glitch is the values will be written to the target file and how to overcome that.
  • Extra line generated in the file with file name\directory hampers processing at the target system and target system reluctant to ignore the extra line during processing.

Technical solution:

Here is the example of the source message with multiple records and the data identifier on basis of which records will be segregated into multiple files say File1, File2 and File3.

/wp-content/uploads/2013/05/1_222207.jpg

Now it is required to generate 3 files, based on values of Field3 in the source message.

Splitting of message and Grouping of data:

Splitting the source message and into 3 messages and grouping the data can be achieved easily by graphical mapping through multi-mapping.

/wp-content/uploads/2013/05/2_222208.jpg

Value mapping to store file name/directory:

File name and directory corresponding to different can be stored in Value mapping to provide flexibility to add or delete more values and the entire solution would work seamlessly without changes in mapping.

Snapshot of Value mapping

/wp-content/uploads/2013/05/3_222227.jpg

Definition of structure for file name/directory:

To facilitate variable substitution, the target structure is created as below:

/wp-content/uploads/2013/05/4_222228.jpg

At runtime, the values will be retrieved from Value mapping table and the fields for each target message will be populated as below:

/wp-content/uploads/2013/05/5_222229.jpg

Configuration of the adapter and variable substitution:

Normally the file created by normal FCC for this scenario will have the last line having FileName, DIR as stated above since they are part of the message.

Following are the screenshots with normal settings of an adapter in case of variable substitution:

Target Tab

/wp-content/uploads/2013/05/6_222230.jpg

Advanced Tab

/wp-content/uploads/2013/05/7_222231.jpg

Adapter is configured with the details that the target structure has structure Record and File and the File has fields FileName and Directory. It might be the case that the third party does not want the file name and directory name in the file so the final task remains on how to trick the adapter into believing that these fields

have length 0.

Content Conversion Tab

$DA1FB1958BF71F6.jpg

This way in the final output the file name and directory name are not written.

Hope it was informative!

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply