Decide branch doesn’t execute

Home Page Forums BizTalk 2004 – BizTalk 2010 Decide branch doesn’t execute

Viewing 1 reply thread
  • Author
    Posts
    • #17534

      Hello all,

      I've narrowed down an issue to a Decide branch that doesn't execute; I suspect it is my award-winning code, but I don't know why. 

      I process an XML file that contains orders, and during that process I do a SQL lookup to translate the existing customer number and retrieve the SAP customer number.  Sometimes the customer doesn't exist (yet) in SAP and I need to flag the order accordingly. The field I'm testing is the Customer Bill-To number.

      Decide Rule 1 works; it tests that the Bill-To isn't blank, which indicates that it was a successful lookup: SAPOrderInstance(PlantOrderSchemas.PropertySchema.BILLTO) != ""

      Decide Rule 2 does *not* work or never executes; it tests that the Bill-To is blank
      indicating that the lookup failed:
      SAPOrderInstance(PlantOrderSchemas.PropertySchema.BILLTO) == ""

      I've placed an expression in each Decide Rule branch (System.Diagnostics.EventLog.WriteEntry("Branch 1", "Cust OK");) and Decide Rule 1 works beautifully, however Decide Rule 2 is never executed.

      The only thing I can think of is that I'm catching Missing Property Exceptions through the scope and the Decide is within the scope.

      Any ideas?  Many thanks.

       

       

    • #17539

      Why are you using the promoted values and not distinguished fields?  What happens if you write out the value (BILLTO) to the event log?  What's in there when the blank occurs?

      • #17540

        Rseroter,

        actually the field is promoted AND distinguished; not sure if that is completely correct since what I've seen on the subject is limited.  Haven't been able to write the value (yet) to the event log since I can only grab it when the lookup is successful.

         

        • #17541

          Ok.  But can't you just write to the event log immediately after the lookup to see what the document (or field) contains?  Why wait until the decision shape to print the data out? 

           FYI, you'll only want to promote a field if you're using it to route messages through the engine.  That is, if you want a subscription on a send port that says "Customer.State == CA", then you need "State" to be promoted.  If you simply want to use "Customer.Zip" in an orchestration, distinguish the field only.

          • #17542

            Rseroter,

            I tried writing to the event log immediately and I can capture the field on a successful lookup only.  On a failed lookup it's blank.  Here's the stored procedure:

            set ANSI_NULLS ON
            set QUOTED_IDENTIFIER ON
            go

            ALTER PROCEDURE [dbo].[TranslateLegacyCustomerNumber]
                (
                    @LegacyCustomerNumber nvarchar(255)
                )
            AS
                SET NOCOUNT ON;
               
                SELECT        LegacyCustomerNumber,
                            SAPCustomerNumber,
                            CustomerName
                    FROM    CustomerTranslation
                    WHERE    LegacyCustomerNumber = @LegacyCustomerNumber
                FOR XML AUTO

                RETURN

             

             

          • #17565

            Rseroter,

            in addition to my prior reply on Friday, I forgot to mention that the Customer Lookup is in a scope.

            Any and all help appreciated!

            Thanks. 

            • #17566

              Hmm, so you say the "field is blank" when there is no corresponding value.  What happens if you create a variable/message of type XmlDocument, then set your response document to that XmlDocument.  Then you can spit out the whole XML message to the event log.  Can we see if the node doesn't exist, vs being empty (<BillTo />)?  I'm thinking that if it was just empty, your ' BillTo == "" ' would be ok.  But more info is needed.

              • #17568

                Appreciate the reply.

                Fairly new at this but I'll try creating a variable and outputing the response to it – that helps a lot!  Thanks for the insight.

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