Flat File schema creation

Hi All,

We have an incoming flatfile input in the below format.

   "99103" "2" "Pfgh AS, Nskim avd, 522" "12629" "12545" "20141001" "" "Omsetningsleie mva pl. kredit november 2014 - Askim Storhandel - Nskim Storhandel"

   "99103" "2" "Jkifnysk AS, Amkinkim avd, 522" "12629" "12545" "20141001" "" "xyzdgfjsleie mva pl. kredit August 2014 - Askim Storhandel - Amkinkim Storhandel"

We need to create a repeating record, with 8 fields in it.Where in the first filed has always 3 empty spaces.

Problem

I  have tried using SPACE as delimiter , but since the data has spaces in between , additional fields are generated by separating a single field data. Eg below:

1st time record repeat, 3rd field data - "Pfgh AS, Nskim avd, 522"

2nd time record repeat, 3rd field data - "Jkifnysk AS, Amkinkim avd, 522"

The problem especially arises in the first field of empty spaces and the field with data.

We tried creating the flatfile using positional, giving wrap charaters(") aswell yet it fails.



December 29th, 2014 11:27am

Hi,

Follow the step as below, I have tried with your sample input instance and it works:

  1. To start with have an input instance file without the spaces in Field3 and Field8
 

   "99103" "2" "PfghAS,Nskimavd,522" "12629" "12545" "20141001" "" "Omsetningsleiemvapl.kreditnovember2014-AskimStorhandel-NskimStorhandel"

   "99103" "2" "JkifnyskAS,Amkinkimavd,522" "12629" "12545" "20141001" "" "xyzdgfjsleiemvapl.kreditAugust2014-AskimStorhandel-AmkinkimStorhandel"


Provide this as the input to the Flat-file schema wizard. Note, the above given input instance does have 3 spaces at the start of every line. i.e 3 spaces before "99103".

  1. Then as usual for record delimiter select {CR}{LF}. And in the Child elements page, set the first record as Repeating Record and second/others as Ignore I believe, youre already doing this.
  2. Then while delimiting the record:
    1. In Child Delimiter, select {SPACE}
    2. And select the check box Record has a tag identifier and in Tag: <<give two space- Just type 2 spaces>>, then you will have child elements as shown in the below image. See the sample data used in Field3 and Field8 doesnt contain spaces as mentioned.
  3. Once you get the schema created:
    1. Give Wrap Character Type  - Character
    2. And Wrap Character .

Now if you get space between the Field3 and Field8 elements, this schema shall work as below:

We gave input instance without spaces to wizard to make the parsing easier with the wizard, then the generated schema can be updated as mentioned to handle the schema as your requirement.

See the above image after updating the schema, Now this output instance has Field3 and Field8 with text with spaces and has 8 fields as you wanted. Following is the schema for the same.

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://TryDelNot.ff1.FlatFileSchema6" targetNamespace="http://TryDelNot.ff1.FlatFileSchema6" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
      <b:schemaInfo standard="Flat File" codepage="65001" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="Root" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Root">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:annotation>
          <xs:appinfo>
            <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
          </xs:appinfo>
        </xs:annotation>
        <xs:element maxOccurs="unbounded" name="Root_Child1">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo tag_name="   " structure="delimited" child_delimiter_type="hex" child_delimiter="0x20" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
            </xs:appinfo>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:annotation>
                <xs:appinfo>
                  <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
                </xs:appinfo>
              </xs:annotation>
              <xs:element name="Root_Child1_Child1" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="1" wrap_char_type="char" wrap_char="&quot;" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Root_Child1_Child2" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="2" wrap_char_type="char" wrap_char="&quot;" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Root_Child1_Child3" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="3" wrap_char_type="char" wrap_char="&quot;" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Root_Child1_Child4" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="4" wrap_char_type="char" wrap_char="&quot;" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Root_Child1_Child5" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="5" wrap_char_type="char" wrap_char="&quot;" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Root_Child1_Child6" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="6" wrap_char_type="char" wrap_char="&quot;" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Root_Child1_Child7" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="7" wrap_char_type="char" wrap_char="&quot;" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Root_Child1_Child8" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="8" wrap_char_type="char" wrap_char="&quot;" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

You may need to change the namespace name, record and field names as per your requirement.

Free Windows Admin Tool Kit Click here and download it now
December 29th, 2014 3:12pm

Worked like a charm. thanks a lot!
February 10th, 2015 8:13pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics