Order of looping functoid output

Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Order of looping functoid output

Viewing 1 reply thread
  • Author
    Posts
    • #22097

      Hello all,

      I got a question about the looping functoid. Is there a way to determine the order of its output?

      Let me explain with an example. Consider this schema:

      <root>
        <record>
          <index />
          <typeA>
            <description />
          </typeA>
          <typeB>
            <description />
          </typeB>
          <typeC>
            <description />
          </typeC>
        </record>
      </root>

      Where both ‘record’ as all types are unbounded in Max Occurs.

      Let’s say I’ve got this input file:

      <root>
        <record>
           <index>1</index>
           <typeA>
             <description>type A</description>
           </typeA>
           <typeB>
             <description>type B</description>
           </typeB>
           <typeC>
             <description>type C</description>
           </typeC>
        </record>
        <record>
           <index>2</index>
           <typeB>
             <description>again type B</description>
           </typeB>
           <typeC>
             <description>again type C</description>
           </typeC>
        </record>
        <record>
           <index>3</index>
           <typeA>
             <description>another type A</description>
           </typeA>
           <typeA>
             <description>last type A</description>
           </typeA>
           <typeC>
             <description>last type C</description>
           </typeC>
        </record>
      </root>

      For each type I want a record in the output file like this:

      <root>
        …
        <record>
          <index>index node of parent record</index>
          <type>name of type (node name)</type>
          <description>description of type</description>
        </record>
        …
      </root>

      So I use a looping functoid for every type in the input file (one functoid and I connect all types to it) and I expect the following output:

      <root>
        <record>
          <index>1</index>
          <type>typeA</type>
          <description>type A</description>
        </record>
        <record>
          <index>1</index>
          <type>typeB</type>
          <description>type B</description>
        </record>
        <record>
          <index>1</index>
          <type>typeC</type>
          <description>type C</description>
        </record>
        <record>
          <index>2</index>
          <type>typeB</type>
          <description>again type B</description>
        </record>
        <record>
          <index>2</index>
          <type>typeC</type>
          <description>again type C</description>
        </record>
        <record>
          <index>3</index>
          <type>typeA</type>
          <description>another type A</description>
        </record>
        <record>
          <index>3</index>
          <type>typeA</type>
          <description>last type A</description>
        </record>
        <record>
          <index>3</index>
          <type>typeC</type>
          <description>last type C</description>
        </record>
      </root>

      But what I’m getting is:

      <root>
        <record>
          <index>1</index>
          <type>typeA</type>
          <description>type A</description>
        </record>
        <record>
          <index>3</index>
          <type>typeA</type>
          <description>another type A</description>
        </record>
        <record>
          <index>3</index>
          <type>typeA</type>
          <description>last type A</description>
        </record>
        <record>
          <index>1</index>
          <type>typeB</type>
          <description>type B</description>
        </record>
        <record>
          <index>2</index>
          <type>typeB</type>
          <description>again type B</description>
        </record>
        <record>
          <index>1</index>
          <type>typeC</type>
          <description>type C</description>
        </record>
        <record>
          <index>2</index>
          <type>typeC</type>
          <description>again type C</description>
        </record>
        <record>
          <index>3</index>
          <type>typeC</type>
          <description>last type C</description>
        </record>
      </root>

      So the output is ordered by the type. I’ve noticed that it’s determined by the order of the looping functoid input parameters. Is this example I connected the types to the looping functoid in this order: typeA, typeB, typeC. So when I change it to: typeB, typeA, typeC, all typeB’s are first put in the output, then the typeA’s and then the typeC’s.

      I hope someone can tell me if what I want is possible (via the mapping GUI).

      If anyone’s wondering: The order matters because the output will eventually be a flat file that’s read by a not so flexible system.

    • #22104

      I got it working. It wasn’t that hard to figure out after all.

      In the output I added another node like so:

      <root>
        …
        <record>
          <part>
            <index>3</index>
            <type>typeC</type>
            <description>last type C</description>
          </part>
        </record>
        …
      </root>

      I connect the <record> from the input file via a looping functoid to the <record> from the output file. All the type nodes are all connected via a single looping functoid to the <part> node in the output file.

      In the eventual flat file the extra <part> nodes don’t matter.

       

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