|
Home > Archive > BizTalk Server General > December 2005 > Positional Flat Files and empty dates
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Positional Flat Files and empty dates
|
|
| kimpton 2005-11-30, 7:57 am |
| Hi All,
We have a positional flat file which contains a number of date fields
formated yyyyMMdd, which may be blank. We are mapping these fields to an XML
Schema field where the field is a Union of 'xs:date xs:string'. To avoid
using a functoid to do the mapping we hoped to use the flat file schema to
set the type correctly. Again using a union ''xs:date xs:string" for the flat
file field.
This is the method suggested in this thread:
http://groups.google.com/group/micr...6
3bbe727
As mentioned in the thread this doesn't work. The field is always treated as
string and not converted to xs:date.
I've tried creating some simple types to use in the union.
I created a FlatFileDateType simpleType (with the appropriate xs:appinfo
including the flat file date format information). However the flat file date
format information did not seem to get communicated in the process. (Even if
the element was just of that type, it would only work if date format
information was entered again for the element).
Secondly I tried creating a Simple type restriction to match the blank date
and then having a union of 'xs:date BlankDateType'. However selecting this
combination the Custom Date/Time format box would disappear, so I had nowhere
to enter the date format!
Any help would be appreciated on this. I don't really want to use a functoid
or to just treat them as strings throughout as suggested in some threads.
Thanks
K
| |
| WenJun Zhang[msft] 2005-12-01, 2:48 am |
| Hi K,
I'm not sure if the problem is on flat file part because using union type
field is just the solution to allow empty value for a type that doesn't
allow empty. Have you tested the schema with an XML instance contains empty
field instead of flat file?
Also if possible, could you please provide the flat file instance for me to
make a test? My email address is: wjzhang@online.microsoft.com (remove
online.)
Thanks.
Best regards,
WenJun Zhang
Microsoft Online Partner Support
This posting is provided "AS IS" with no warranties, and confers no rights.
| |
| kimpton 2005-12-01, 7:48 am |
| Hi,
Here's an example flat file format:
20041026DATA1
20041025DATA2
and schema (just using xs:date for the moment):
<snip...>
<xs:element name="CouldBeBlankDate" type="xs:date">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="right" sequence_number="1" pos_length="8"
pos_offset="0" pad_char_type="hex" pad_char="0x20" datetime_format="yyyyMMdd"
/>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="OtherData" type="xs:string">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="right" sequence_number="2" pos_length="5"
pos_offset="0" pad_char_type="hex" pad_char="0x20" />
</xs:appinfo>
</xs:annotation>
</xs:element>
</....snip>
This is fine and generates:
<Records xmlns="http://Schema.FlatFileEmptyDates">
<Record xmlns="">
<CouldBeBlankDate>2004-10-26</CouldBeBlankDate>
<OtherData>DATA1</OtherData>
</Record>
<Record xmlns="">
<CouldBeBlankDate>2004-10-25</CouldBeBlankDate>
<OtherData>DATA2</OtherData>
</Record>
</Records>
(Notice the dates have been converted to xs:date.)
However the date fields may be blank, which would cause an obvious 'not a
valid date' error on validate. Updating the 'CouldBeBlankDate' element to use
union:
<xs:element name="CouldBeBlankDate">
<xs:annotation>
<xs:appinfo>
<b:fieldInfo justification="right" sequence_number="1" pos_length="8"
pos_offset="0" pad_char_type="hex" pad_char="0x20" datetime_format="yyyyMMdd"
/>
</xs:appinfo>
</xs:annotation>
<xs:simpleType>
<xs:union memberTypes="xs:date xs:string" />
</xs:simpleType>
</xs:element>
Causes two problems. Firstly, it still gets an 'invalid date format' error
on validate, I suspect because the datetime_format is still defined. However,
if I don't have any blank dates, it doesn't convert the dates either, they
are just passed as strings e.g resulting schema using the flatfile above:
<Records xmlns="http://Schema.FlatFileEmptyDates">
<Record xmlns="">
<CouldBeBlankDate>20041026</CouldBeBlankDate>
<OtherData>DATA1</OtherData>
</Record>
<Record xmlns="">
<CouldBeBlankDate>20041025</CouldBeBlankDate>
<OtherData>DATA2</OtherData>
</Record>
</Records>
Thanks for your help.
K
""WenJun Zhang[msft]"" wrote:
> Hi K,
>
> I'm not sure if the problem is on flat file part because using union type
> field is just the solution to allow empty value for a type that doesn't
> allow empty. Have you tested the schema with an XML instance contains empty
> field instead of flat file?
>
> Also if possible, could you please provide the flat file instance for me to
> make a test? My email address is: wjzhang@online.microsoft.com (remove
> online.)
>
> Thanks.
>
> Best regards,
>
> WenJun Zhang
> Microsoft Online Partner Support
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
| |
| WenJun Zhang[msft] 2005-12-05, 7:51 am |
| Hi Paul,
I've reproduced the problem. The union type method works fine on XML
schema, but doesn't work in flat file scenario. I'm currently researching
where the problem is.
Please wait for my update. Thanks.
Best regards,
WenJun Zhang
Microsoft Online Partner Support
This posting is provided "AS IS" with no warranties, and confers no rights.
| |
| WenJun Zhang[msft] 2005-12-09, 2:50 am |
| Hi Paul,
The problem has been reproduced but we cannot find any existent solution of
it currently. To further research on this issue, it requires you open a
support incident to our product support service for an advanced live
support. Each MSDN subscriber has 2 free incident accounts. You can find
the phone number from the link below:
http://support.microsoft.com/defaul...US;PHONENUMBERS
Thanks.
Best regards,
WenJun Zhang
Microsoft Online Partner Support
This posting is provided "AS IS" with no warranties, and confers no rights.
|
|
|
|
|