Add CRLF to Flat File

Home Page Forums BizTalk 2004 – BizTalk 2010 Add CRLF to Flat File

Viewing 1 reply thread
  • Author
    Posts
    • #17158

      Hi

      I have to generate a Flat file from XML and add CRLF at the end,please let me know how to add this.

      I have tried adding a dummy tag in the schema with Default Value as \r\n so that it automatically writes at the end of the file,but did'nt work

      the data type was xs:string . Thanks for your help.

       

      Thanks

      Wincy

    • #17161

      Wincy,

      normally you should do this by the use of "child order". This can be either prefix, infix or postfix. It tells the assembler where to put record delimiters. I guess you need Postfix – that is, put delimiters (CR/LF) at the end of each record.

      John D.

      • #17178

        Hi John

        Thanks 🙂 I added a dummy second child record and in the top node i gave Child order as Postfix and child delimiter as 0x0d 0x0a ..

        it worked

        –  Wincy 

         

        • #19688

          hello Wincy, 

          Can you describe what you did in more detail ?

          What if there is only one rootnode ? Example would be as follows:

            <?xml version=”1.0″ encoding=”utf-16″ ?>
          <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=”SASScrapData child_delimiter_type=”hex default_child_delimiter=”0x0D 0x0A />
            </xs:appinfo>
            </xs:annotation>
          <xs:element name=”SASScrapData>
          <xs:annotation>
          <xs:appinfo>
            <b:recordInfo structure=”delimited child_delimiter_type=”char child_delimiter=”| child_order=”infix sequence_number=”1 preserve_delimiter_for_empty_data=”true suppress_trailing_delimiters=”false />
            </xs:appinfo>
            </xs:annotation>
          <xs:complexType>
          <xs:sequence minOccurs=”1 maxOccurs=”unbounded>
          <xs:annotation>
          <xs:appinfo>
            <groupInfo sequence_number=”0 xmlns=”http://schemas.microsoft.com/BizTalk/2003 />
            </xs:appinfo>
            </xs:annotation>
          <xs:element name=”PlantOfOrigin type=”xs:string>
          <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification=”left sequence_number=”1 min_length_with_pad=”4 pad_char_type=”default />
            </xs:appinfo>
            </xs:annotation>
            </xs:element>
          <xs:element name=”LotID type=”xs:string>
          <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification=”left sequence_number=”2 pad_char_type=”default min_length_with_pad=”13 />
            </xs:appinfo>
            </xs:annotation>
            </xs:element>
          <xs:element name=”LotClass type=”xs:string>
          <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification=”left sequence_number=”3 min_length_with_pad=”13 pad_char_type=”default />
            </xs:appinfo>
            </xs:annotation>
            </xs:element>
          <xs:element name=”ScrapDate type=”xs:string>
          <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification=”left sequence_number=”4 pad_char_type=”default min_length_with_pad=”13 />
            </xs:appinfo>
            </xs:annotation>
            </xs:element>
          <xs:element name=”Location type=”xs:string>
          <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification=”left sequence_number=”5 min_length_with_pad=”40 pad_char_type=”default />
            </xs:appinfo>
            </xs:annotation>
            </xs:element>
          <xs:element name=”ScrapDescription type=”xs:string>
          <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification=”left sequence_number=”6 min_length_with_pad=”40 pad_char_type=”default />
            </xs:appinfo>
            </xs:annotation>
            </xs:element>
          <xs:element name=”StageNumber type=”xs:string>
          <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification=”left sequence_number=”7 min_length_with_pad=”20 pad_char_type=”default />
            </xs:appinfo>
            </xs:annotation>
            </xs:element>
          <xs:element name=”StepID type=”xs:string>
          <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification=”left sequence_number=”8 min_length_with_pad=”20 pad_char_type=”default />
            </xs:appinfo>
            </xs:annotation>
            </xs:element>
          <xs:element name=”MPCode type=”xs:string>
          <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification=”left sequence_number=”9 min_length_with_pad=”20 pad_char_type=”default />
            </xs:appinfo>
            </xs:annotation>
            </xs:element>
          <xs:element name=”PlanID type=”xs:string>
          <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification=”left sequence_number=”10 min_length_with_pad=”20 pad_char_type=”default />
            </xs:appinfo>
            </xs:annotation>
            </xs:element>
          <xs:element name=”MSL type=”xs:string>
          <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification=”left sequence_number=”11 min_length_with_pad=”20 pad_char_type=”default />
            </xs:appinfo>
            </xs:annotation>
            </xs:element>
          <xs:element name=”WaferScrapQuantity type=”xs:string>
          <xs:annotation>
          <xs:appinfo>
            <b:fieldInfo justification=”left sequence_number=”12 min_length_with_pad=”20 pad_char_type=”default />
            </xs:appinfo>
            </xs:annotation>
            </xs:element>
            </xs:sequence>
            </xs:complexType>
            </xs:element>
            </xs:schema>

          Thanks in Advance.

          tgbtg

          • #19694

            Please disregard my inquiry.

            I was succesfull in resolving my problem with the concept of having the “higher node” define the child delimiter as the 0x0D and 0x0A hex characters.

            Thinking that others may have the same confusion or problem as I had, let me describe what I did to resolve the issue on not having the CRLF after each record.

            With the schema generated from the Flat File Schema Wizard having a rootnode, and then all the elements under it. The resulting text output of the send port’s file set to “Append” in Copy mode has NO CRLF for every record. The flat file format requires the pipe as the delimiter and at the same time the column/fields are fixed – see the schema I posted previously.

            My solution to the No-CRLF problem:

            1 – Add a child node under the rootnode.

            2 – Move all the elements from the rootnode to the childnode added in step1.

            3 – Specify the rootnode to have the following child delimiter specifications:

                  child delimiter: 0x0D 0x0A

                  child delimiter type: hexadecimal

                  child order: PostFix

            4. Specify the childnode (added in step#1) to have the following child delimiter specifications:

                  child delimiter: |

                  child delimiter type: Character

                  child order: Infix

            I hope this is clearer for the BizTalkers who will encounter the same problem and are confused.

            Regards !

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.