Skip to Content
0
Former Member
Mar 12, 2007 at 07:41 PM

Manipulate Dates in XI Message Mapping

187 Views

Hello all,

I have a problem in which I need to take a date from my source file and manipulate this date to help produce my target structure.

<i><b>This is not my actual XML</b></i>

<source root>
  <field 1>A</field 1>
  <field 2>Any value</field 2>
  <field 3>Next value</field 3>
  <field 4>20070201</field4>
</source root>

Consider the above XML as my source. I would like to have logic in the message mapping that will check the value of a field (field 1) and based on it's value add or subtract days from the date value provided.

This would be my output for adding ten (10) days if '<b>field 1</b>' has a value of '<b>A</b>'

<target root>
  <target 1>A</target 1>
  <target 2>Any Value</target 2>
  <target 3>Next Value</target 3>
  <target 4>20070211</target 4>
</target root>

This would be my output for subtracting five (5) days if '<b>field 1</b>' has a value of '<b>B</b>' (Same source file)

<target root>
  <target 1>B</target 1>
  <target 2>Any Value</target 2>
  <target 3>Next Value</target 3>
  <target 4>20070127</target 4>
</target root>

As you can see there is a field in my source system that will tell me what type of logic to perform. The problem that I am having now is that the message mapping functions that currently exist are not helping me satisfy this requirement. I have viewed several forums and tried several of the suggestions given but nothing seems to help. Does anyone know how to solve this problem? Is there a UDF that anyone has used that would help me in solving this requirement? The solution should be dynamic to account for leap years as well as for the different days that each month has.

Answers received will be rewarded with points.

Thanks in advance for the help that you provide.