More mapping advice needed

Home Page Forums BizTalk 2004 – BizTalk 2010 More mapping advice needed

Viewing 1 reply thread
  • Author
    Posts
    • #16707

      Earlier I asked about mapping restricted/enumerated attributes to a different set of values in the destination schema, e.g.:

      • Y->Approved
      • N->Denied
      • U->Unknown

      trayburn suggested a functoid, so here's my first take on it (minus the boilerplate functoid stuff):

      public string HashMatch(string inputValue, string valuePair1, string valuePair2, string valuePair3)
      {

                  string[] hashPair = { valuePair1, valuePair2, valuePair3 };

                  System.Collections.Hashtable ht = new System.Collections.Hashtable(hashPair.Length);
                  foreach (string entry in hashPair)
                  {
                      string[] keyValuePair = entry.Split(new char[] { '>' });
                      ht.Add(keyValuePair[0], keyValuePair[1]);
                  }

                  return (string)ht[inputValue];

      }

      Usage would look like a link from the source schema, followed by constants describing the mapping, e.g. "Y>Approved", "N>Denied", "U>Unknown".

      It appears to work for my test cases.  So apart from the hackney calling convention and waste of hashtable for a single lookup, is there anything wrong with this approach?

      Thanks again

    • #16721

      You made it too complicated.  Here:

      Function Lookup (parameter_in)

       Select case parameter_in
          case "Y"

             Lookup = "Approved"

          case "N"

             Lookup = "Denied"

          case "U"

             Lookup = "Unknown"

          case else

             Lookup = ""

        End Select

      End Function
       

      This might use less object invocation.

      – Weak Architect
       

        

       

       

       

      • #16730

        Well I was trying to solve the general case, which is the idea of functoids.  The example I gave was just one mapping I need, there are many such mappings I need to make where I need to map a set of X values to a set of Y values.

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