Search code examples
xsdbiztalkflat-filebiztalk-2013biztalk-schemas

Complex Flat file, is this even possible to do with a Flat file schema in BTS2013R2?


I have been given the task to create an integration between a customers system and an internal system. The customer sends a flat file which I have a hard time getting my head around how to parse using a Flat file schema.

The structure is like this:

H[n] (either H1, H2 or H3)
  K3 (0..unbounded)
    K4 (0..unbounded)   
  M4 (0..unbounded)
    M5 (0..unbounded)   
  S4 (0..unbounded)
    S5 (0..unbounded)

Each of the lines ends with a normal CR/LF and each line is position based.

Example:

H1    0123    TEST        L5A3
K3 20160608   1103   0004
K4 XA    TEST       01
M41123  AQ
M5SA
M5X1
S4SENDOUT
S5POP
H1Q   0342    TEST2       KY
S4IN
H3A   1408    TESTING     S6T2    
M43308   BB
H2    1331    TEST3       SA
S4PO

This should generate 4 XML-nodes in the end, but my primary concern is how to be able to create a schema that could actually interpret this, either using the Flat File Schema Wizard or simply using a Flat File Schema.

Is this even feasible (considering the various line types, message lengths etc)?


Solution

  • I don't see why BizTalk would have a hard time parsing this flat file. Your lines are clearly identified with the two first characters. You can use this as a tag identifier for the record.

    I think it's quite a typical example for a structured, positional flat file with repeating records.

    This example might give you some indication as to how to do this, it is somewhat similar: Flat File Schema creation with Tag Identifiers in the input flat file repeating in a random fashion.

    In your situation you would have to create the flat file schema using the flat file wizard. Speaking mostly from my own experience, you never get it perfectly correct, so some tweaking of the FF XSD might be necessary.

    To ultimately get to your result XML, use a mapping to get from your flat file schema to your desired output XML result schema.