Topic
No replies
NASCARFan
NASCARFan
19 Posts
ACCEPTED ANSWER

Pinned topic DTM DateTime mapping to separate XML elements

‏2014-06-23T18:37:02Z |

Hello and Good Day, ALL!

I have run into a bit of a challenge for which I am sure a solution exists.

I am able to map Date & Time from a single DTM segment string to separate XML elements, where:

DTM+189:1309271540:201'

Yields:

<DepartureDate>20130927</DepartureDate>

<DepartureTime>1540</DepartureTime>

 

HOWEVER, the input DT/TM string MAY optionally feature a six byte DATEabsent 'CC' DTM+189:09271540:201'

While at one time I was able to get the below rule to work for 6 byte DATES, its NOW yielding an EMPTY <DepartureDate> element, but <DepartureTime> is accurately mapped.

 

=IF (TEXTTONUMBER( DateTimePeriodFunctCdQual'r Element:DateTimePeriod Composite:DTM Segment:Group3:In1 ) = 189, EITHER( FROMDATETIME(TODATETIME(LEFT(DateTimePeriodVal Element:DateTimePeriod Composite:DTM Segment:Group3:In1  , 12),   "{CCYYMMDDHH24MM}"), "{CCYYMMDD}"),  FROMDATETIME(TODATETIME(LEFT( DateTimePeriodVal Element:DateTimePeriod Composite:DTM Segment:Group3:In1  , 10), "{YYMMDDHH24MM}"), "{CCYYMMDD}")), NONE)

 

THEN, as for TIME:

The <DepartureTime>  rule I am using is: 

=IF (TEXTTONUMBER( DateTimePeriodFunctCdQual'r Element:DateTimePeriod Composite:DTM Segment:Group3:In1 ) = 189,

 RIGHT( DateTimePeriodVal Element:DateTimePeriod Composite:DTM Segment:Group3:In1 , 4), NONE)

 

BUT interestingly, when the TIME is missing (DTM+189:130927:201')   the results are: 

<DepartureDate></DepartureDate>

<DepartureTime>0927</DepartureTime>

 

Personally, I want to tell the Test team that since the data is required by the application, bad and  insufficient data is just that.  However, I want to pursue this if it can be done accurately.

Any feedback most appreciated!

Bud - Customs