Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FlatFile validate date and optional fields

96 views
Skip to first unread message

Stefan

unread,
Jan 23, 2009, 8:17:30 AM1/23/09
to
Hi,

I came across an issue while dealing with the flat file.
First let me explain the context,
I have a flat file that I need to validate before continuing the
processing.

The flat file looks like this

Root
RepeatingRecord (with 0x0D 0x0A as a delimiter, the child elements
are positional)
Element1
Element2
Element3
RepeatingPositionalRecord (positional ChildElements - no
delimiter)
ChildElement1
ChildElement2
ChildMyDate
ChildElement3

Ok so here is the issue, I want to validate that MyDate is a date of
format yyyy-mm-dd, and if there are spaces it is not an error the
MyDate must be considered as null. If any of ChildElemets contains
only space characters it must be considered null as well (the node
must not appear in the resulting xml)

Here is what I did (explained in http://www.itsconsulting.fr/fr/blog/viewpost/6)

-The padding character is space (which makes the ChildElemets null if
there is only space characters)
and therefore if MyDate contains spaces it is considedred as correct
because it is null

This however does not validate the schema because if ChildElement2 is
missing, because it is not part of the resulting xml I got the error
the MyDate is present while ChildElement2 was expected

Ok so from there I specify that all the ChildElements are optional
(min occurs set to 0) but then all the validating schema gets messed
up, because I don't know how biztalk ill-considers optional elements
inside a positional flat file, I get something really messy and not at
all what I would have expected?

Any hint on this issue?

Regards,
Stefan
http://www.itsconsulting.fr
http://www.itsconsulting.fr/fr/nos-offres/microsoft/1-biztalk
http://www.itsconsulting.fr/blog

Martin Bring (Sogeti Sverige AB)

unread,
Jan 27, 2009, 3:32:02 AM1/27/09
to
Hi Stefan

I think you are on the right track. It is only one property more you have to
set, "Supress empty nodes".

One thing you can get stuck on with flat file is "How can one have optional
fields in a positional file?" Think of it this way, it is the resulting
"internal" xml that is validated. So if you have a datetime with no value,
you have to make it a valid nullable xml.

These three options made it work for me:
Suppress Empty Nodes = Yes (at schema level)
MinOccurs = 0
PadCharacter = ' '

Kind Regards
Martin Bring

pruthvi

unread,
Mar 29, 2010, 8:10:09 PM3/29/10
to
Hi Stefan,
I am facing the same problem. I have created the flatfile schema with the structure :

Root
Segment1--attr1, attr2, attr3
Segment2--attr4, attr5, attr6
Segment3--attr7, attr8, attr9

Here is the sample input:
Seg1+attr1+attr2+attr3 '
Seg2+attr4:attr5+attr6'
Seg3+attr7+attr8+attr9'

The problem is some times i receive the input file as:

Seg1+attr1+attr2+attr3 '
Seg3+attr7+attr8+attr9'

So when i get this kind of input file,When i am trying to validate against the schema, only segment 1 is recognised in the message and only Segment1 is getting populated in the validated output.

Help me regarding the same.
Thanks in advance

Pruthvi

MartinBringSogetiSverigeA wrote:

Hi StefanI think you are on the right track.
27-Jan-09

Hi Stefan

I think you are on the right track. It is only one property more you have to
set, "Supress empty nodes".

One thing you can get stuck on with flat file is "How can one have optional
fields in a positional file?" Think of it this way, it is the resulting
"internal" xml that is validated. So if you have a datetime with no value,
you have to make it a valid nullable xml.

These three options made it work for me:
Suppress Empty Nodes = Yes (at schema level)
MinOccurs = 0
PadCharacter = ' '

Kind Regards
Martin Bring


"Stefan" wrote:

Previous Posts In This Thread:

On Sunday, January 25, 2009 2:04 PM
Stefan wrote:

FlatFile validate date and optional fields
Hi,

On Tuesday, January 27, 2009 3:32 AM
MartinBringSogetiSverigeA wrote:

Hi StefanI think you are on the right track.
Hi Stefan

I think you are on the right track. It is only one property more you have to
set, "Supress empty nodes".

One thing you can get stuck on with flat file is "How can one have optional
fields in a positional file?" Think of it this way, it is the resulting
"internal" xml that is validated. So if you have a datetime with no value,
you have to make it a valid nullable xml.

These three options made it work for me:
Suppress Empty Nodes = Yes (at schema level)
MinOccurs = 0
PadCharacter = ' '

Kind Regards
Martin Bring


"Stefan" wrote:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Making Silverlight Emulate Synchronous Requests
http://www.eggheadcafe.com/tutorials/aspnet/91f69224-3da5-4959-9901-c5c717c9b184/making-silverlight-emulat.aspx

pruthvi

unread,
Mar 29, 2010, 8:11:26 PM3/29/10
to
Hi Stefan,
I am facing the same problem. I have created the flatfile schema with the structure :

Root
Segment1--attr1, attr2, attr3
Segment2--attr4, attr5, attr6
Segment3--attr7, attr8, attr9

Here is the sample input:
Seg1+attr1+attr2+attr3 '
Seg2+attr4:attr5+attr6'
Seg3+attr7+attr8+attr9'

The problem is some times i receive the input file as:

Seg1+attr1+attr2+attr3 '
Seg3+attr7+attr8+attr9'

So when i get this kind of input file,When i am trying to validate against the schema, only segment 1 is recognised in the message and only Segment1 is getting populated in the validated output.

Help me regarding the same.

Thanks in advance

Regards,
Pruthvi

MartinBringSogetiSverigeA wrote:

Hi StefanI think you are on the right track.
27-Jan-09

Hi Stefan

I think you are on the right track. It is only one property more you have to
set, "Supress empty nodes".

One thing you can get stuck on with flat file is "How can one have optional
fields in a positional file?" Think of it this way, it is the resulting
"internal" xml that is validated. So if you have a datetime with no value,
you have to make it a valid nullable xml.

These three options made it work for me:
Suppress Empty Nodes = Yes (at schema level)
MinOccurs = 0
PadCharacter = ' '

Kind Regards
Martin Bring


"Stefan" wrote:

Previous Posts In This Thread:

On Sunday, January 25, 2009 2:04 PM
Stefan wrote:

FlatFile validate date and optional fields

Hi,

On Tuesday, January 27, 2009 3:32 AM
MartinBringSogetiSverigeA wrote:

Hi StefanI think you are on the right track.
Hi Stefan

I think you are on the right track. It is only one property more you have to
set, "Supress empty nodes".

One thing you can get stuck on with flat file is "How can one have optional
fields in a positional file?" Think of it this way, it is the resulting
"internal" xml that is validated. So if you have a datetime with no value,
you have to make it a valid nullable xml.

These three options made it work for me:
Suppress Empty Nodes = Yes (at schema level)
MinOccurs = 0
PadCharacter = ' '

Kind Regards
Martin Bring


"Stefan" wrote:

On Monday, March 29, 2010 8:10 PM
pruthvi wrote:

Flat File optional segments


Hi Stefan,
I am facing the same problem. I have created the flatfile schema with the structure :

Root
Segment1--attr1, attr2, attr3
Segment2--attr4, attr5, attr6
Segment3--attr7, attr8, attr9

Here is the sample input:
Seg1+attr1+attr2+attr3 '
Seg2+attr4:attr5+attr6'
Seg3+attr7+attr8+attr9'

The problem is some times i receive the input file as:

Seg1+attr1+attr2+attr3 '
Seg3+attr7+attr8+attr9'

So when i get this kind of input file,When i am trying to validate against the schema, only segment 1 is recognised in the message and only Segment1 is getting populated in the validated output.

Help me regarding the same.
Thanks in advance

Pruthvi


Submitted via EggHeadCafe - Software Developer Portal of Choice

WPF Circular Progress Indicator
http://www.eggheadcafe.com/tutorials/aspnet/4d89b4cb-ba59-4362-ab0a-cc047643fd42/wpf-circular-progress-ind.aspx

Joerg Fischer

unread,
Apr 1, 2010, 5:54:50 AM4/1/10
to
Hi,

Have you set the Seg2 as being optional? Is Seg3 required?

Set the "Allow Message split on infix root" to false.

Regards

Joerg Fischer


"pruthvi" schrieb im Newsbeitrag
news:2010329201123...@gmail.com...

0 new messages