Grouping in the destination schema

Home Page Forums BizTalk 2004 – BizTalk 2010 Grouping in the destination schema

Viewing 1 reply thread
  • Author
    Posts
    • #17520

      I have a source flat file contains list of shipment packages information as line items in sequence. These packages will share common order numbers.

      For example, there are 50 packages in the shipment. 10 packages will share a common order number 101, 4 packages will share another order number 102, so on and so forth.

       

      <shipment>

      <packageid>P1</packageid>

      <weight>5</weight>

      <orderid>101<orderid>

      </shipment>

       

      <shipment>

      <packageid>P2</packageid>

      <weight>3</weight>

      <orderid>101<orderid>

      </shipment>

       

      <shipment>

      <packageid>P11</packageid>

      <weight>5</weight>

      <orderid>102<orderid>

      </shipment>

       

      Destination schema contains order level grouping and corresponding packages in it.    Sample is as follows

       

      <ShimenetOrder>

      <ordernum>101</ordernum>

      <totalweight>120</totalweight>

      <packageid>P1</packageid>

      <packageid>P2</packageid>

      …..

      <packageid>P10</packageid>

      </ShimenetOrder>

       

      <ShimenetOrder>

      <ordernum>102</ordernum>

      <totalweight>80</totalweight>

      <packageid>P11</packageid>

      <packageid>P12</packageid>

      <packageid>P20</packageid>

      </ShimenetOrder>

       

      How can I map source schema to destination schema, so that I will get the above output?  How can achieve this kind of grouping by a specific item, that will be commonly shared by other items in the source schema.

      Thanks in advance,

      -Gopi

    • #17531

      good day Gopi,

      this would be trivial in Mercator, but it is more challenging in Biztalk mapper.

      what you can do is use a scriptoid attached to a cumulative to read in all the order IDs and store them in a global dictionary as keys. this will give you a hash of all orders that can be used as a set of unique order ids.

      then you can have another scriptoid output each unique order ID and use it in a logical tests in an evaluation where you loop through all orders only meeting a true case when you have a match with the provided unique order number.

      it is difficult to explain, but you might be able to phanaggle it to work. To reduce the algorithm, here it is

      – get all unique order ids

      – drive shipments output loop with orders input loop

      – only allow shimenetorder to be created when

          – there are more unique order IDs left

      For each shimenet order, you are looping through all shipments and

           – only allow package id to be created when there is a match between the order id in the source shipment and the scriptoid-provided unique order id

      It will take an extreme amount of experience with the mapper to pull this off.  Maybe someone else has a better idea. This example illustrates one of the things about Biztalk mapper that makes me uncomfortable – it forces you to drive loop iterations off of "features of the input data" rather than for business reasons.  Either that or write a .net app to pre-sort the data before you map it – but that would just be an admission of BizTalk being a poor mapping tool, wouldn't it?

       – wa
       

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