Tallan's Technology Blog

Tallan's Top Technologists Share Their Thoughts on Today's Technology Challenges

Handling of Record Tag Identifiers by BizTalk 2006 Flat File Schema Wizard

Dmitriy Gitelman

Those, who work with BizTalk 2006 Flat File Schema Wizard, probably noticed that record tag identifiers are handled differently for delimited and positional records. Let’s use a simple text file Person.txt for this example.

After opening Flat File Schema Wizard, skipping the Welcome Screen and entering required information on Flat File Schema Information screen we are presented with this Select Document Data screen.

Here tag identifier PERSON marks the whole record and it is followed by a User ID. Next line is person’s name record presented in comma delimited format. This record is tagged with NAME tag identifier. The last line represents person’s address. The address is presented using relative positions format and it is tagged with ADDRESS tag identifier. The children of the root element Person are {CR}{LF} delimited, so we make corresponding selection on Delimited Record screen and enter PERSON as Tag Identifier.

As we can see on the next screen, the wizard detected 3 elements and it stripped PERSON tag from the 1st element. We name the first element UserId, leave Field Element as Element Type and string as Data Type. The second and the third elements are Name and Address and they both have Record element type.

After clicking <Next> and selecting Name in the Schema View screen, we are going to define Name element.

Name element is comma delimited and has NAME tag identifier.

Once again, the wizard identified 3 elements and stripped NAME tag from the 1st one. We rename the elements to FirstName, MiddleInitial and LastName and leave element type and data type with the default values.

After clicking <Next> and selecting Address in the Schema View screen, we are going to define Address element.

Address element is defined by relative positions.

In the Positional Record screen we enter ADDRESS as tag identifier and specify starting positions of all elements using position markers. Note that it is impossible to remove the position marker at position 0.

On the next screen we can see that in this case the wizard treated Tag Identifier differently– it appears as one of the elements. We rename the elements and leave default values in Element Type and Data Type columns.

The schema is created, but we ended with extra element Tag that we don’t have any use for. Let’s take a closer look at this schema.

The flat file schema uses fieldInfo element to define position of the fields. Attribute pos_offset defines starting offset of the field relative to the previous sibling or delimiter. Attribute pos_length defines field length. Now it becomes clear that when we place position markers in the wizard, the wizard assumes that all offsets equal to 0 and markers are used to calculate length only. The wizard does not provide the way to set any position offsets. That is why we end up with extra element Tag. Fortunately we easily can fix it. First we write down the value of Positional Length property of Tag element (10).

After that Tag element can be deleted. Next we select StreetAddress1 element (first element of Address record) and change its Positional Offset property to 10 (the value we wrote down).

Now, the schema is finally created and it does not have any useless elements.

The BizTalk 2006 Flat File Schema Wizard is a great tool that greatly simplifies the task of creation flat file schemas. However, as with all other wizards, minor tweaking might be needed to complete the task.

Tags: BizTalk,

1 Comment. Leave new

Craig Condon
August 2, 2011 6:05 pm

This should be fixed now.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

\\\