ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » DFDL - Set empty dateTime

Post new topic  Reply to topic
 DFDL - Set empty dateTime « View previous topic :: View next topic » 
Author Message
Thomas2ab
PostPosted: Wed Oct 22, 2014 4:43 pm    Post subject: DFDL - Set empty dateTime Reply with quote

Acolyte

Joined: 07 Mar 2014
Posts: 51

Hello everyone,

I would like to know if it it is possible to set dateTime as 8 empty string?
Let me explain better:
Here is my DFDL representation:

[code]<xsd:element dfdl:calendarCheckPolicy="strict" dfdl:calendarPattern="YYYYMMdd" dfdl:calendarPatternKind="explicit" dfdl:calendarTimeZone="UTC-03:00" dfdl:length="8" dfdl:lengthKind="explicit" dfdl:nilKind="literalCharacter" dfdl:nilValue="%SP;" dfdl:representation="text" dfdl:textPadKind="padChar" dfdl:textTrimKind="padChar" dfdl:useNilForDefault="no" maxOccurs="1" minOccurs="1" name="IssueDate" type="xsd:dateTime"/>[/code]

It always works perfectly when the input XML DateTime is coming but what I need to do is, if the input dateTime is not coming, fill the TXT output message with 8 empty string: ' '.
It cannot be set as nothing.

So my question is, is that possible via the DFDL definition or should I do something more custom?

Thanks,

Regards,
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Oct 23, 2014 4:40 am    Post subject: Re: DFDL - Set empty dateTime Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Thomas2ab wrote:
So my question is, is that possible via the DFDL definition or should I do something more custom?


You need something more custom. An field described as an xsd:dateTime has to have a valid date and time in it; a series of spaces is not a valid date & time.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Oct 23, 2014 7:32 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

It's a DFDL model, not an XMl model. So it's perfectly reasonable to use spaces as a value for a datetime, assuming the reading application is expecting them.

The problem is that DFDL does not necessarily output the nil value of an element if the element is not populated in the tree.

It's going to be necessary in the first place to ensure that the element actually exists in the tree and has a NULL value, rather than not existing in the tree.

Then do some searching for posts here from kimbert talking about default values and DFDL.

Then realize that your pattern specifies a single space character, not multiple space characters for the nil value.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Oct 23, 2014 8:19 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

A missing value is one that is not in the data at all. Or not in the message tree at all.
A null value is a value that appears in the data, and matches your 'nil handling' properties. In the message tree, a null value is a field with the special value NULL. See below for what that means, exactly.

Your 'nil handling' properties specify the following:
IF
1. the element is marked as nillable and
2. the field is present in the input data and
3. the field consists of one or more space characters
THEN
the message tree will contain a NULL value for that field.
Please note: a NULL value is not the same as '' ( the empty string ). It is not the same as 'NULL' ( it is not a string ). It is a completely separate value that is not a date, not an integer, not a string...just a NULL. That's why it is useful for representing a value like yours ( 8 spaces is not a valid date ).

Now, if you want to output eight spaces for this field then you have two options:
1. If the field is in OutputRoot.DFDL, then makes sure that it has the value NULL. The nil handling properties will tell DFDL to output 8 spaces.
2. If the field is not in OutputRoot.DFDL then set the 'Use Nil for default' property on the element. The DFDL writer should treat the missing field exactly like a field that has a NULL value.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
Thomas2ab
PostPosted: Thu Oct 23, 2014 5:13 pm    Post subject: Reply with quote

Acolyte

Joined: 07 Mar 2014
Posts: 51

Hello Kimbert and thanks!

Actually I tried the nil property as I really didn't know what to do in that case.
The whole tag is not going to come from the input XML.
But in my mapping node, I am linking via a 'Move' the input date (that did not come in the input xml) to the output.
In this case which property or properties should I add tot he DFDL filed defintion?

Thanks!

Regards,
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Oct 24, 2014 2:51 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Actually I tried the nil property as I really didn't know what to do in that case.
The whole tag is not going to come from the input XML.
But in my mapping node, I am linking via a 'Move' the input date (that did not come in the input xml) to the output
The DFDL parser will write the contents OutputRoot.DFDL - regardless of how it was constructed. So either
a) set the field to a valid dateTime value
or
b) create the field with the value NULL and make sure that the field's nil handling properties are set correctly. Based on your first post, you will need to change the field and make it 'nillable'. I cannot remember whether the Mapping node allows you to set the NULL value on a field - if not then you will need to use ESQL or Java for that part.
_________________
Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » DFDL - Set empty dateTime
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.