about the null values in the request message

Home Page Forums BizTalk 2004 – BizTalk 2010 about the null values in the request message

Viewing 1 reply thread
  • Author
    Posts
    • #21105

       I have scenerio where a request message comes from the client in which they have 3 elements and sometime they wont give values to all the elements and I have to develop a process where if any of these elements have values I have to decide further processes for each one of these elements so when I drag a decide shape its asking me to assign the values as boolean data type so what should I do in this scenerio.

    • #21110

       First define the 3 elements as distinguished fields.  Then here is some code you can use in the decide shape:

      System.String.IsNullOrEmpty(MyMessage.Field1)

      If the client does NOT supply a value, then this expression would return true.

      • #21113

         Hi I have tried that but I am getting this error.

        Uncaught exception (see the ‘inner exception’ below) has suspended an instance of service ‘SCInputSchemas.SCOrches(231f9327-00ca-3b2e-0206-57814632d387)’.

        The service instance will remain suspended until administratively resumed or terminated.

        If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.

        InstanceId: 458288e2-95d6-4962-8d8a-103e04d6e3cf

        Shape name: Decide_1

        ShapeId: 9460a387-ff16-4f99-a6a3-572e8a0b2f3b

        Exception thrown from: segment 1, progress 9

        Inner exception: The string ‘4300’ is not a valid Boolean value.

         

        Exception type: FormatException

        Source: System.Xml

        Target Site: Boolean ToBoolean(System.String)

        The following is a stack trace that identifies the location where the exception occured

        at System.Xml.XmlConvert.ToBoolean(String s)

        at Microsoft.XLANGs.RuntimeTypes.XmlHelpers.ParseString(String s, Type targetType, Boolean throwIfNotParsed)

        at Microsoft.XLANGs.RuntimeTypes.XmlHelpers.ChangeType(Object val, Type targetType)

        at Microsoft.XLANGs.Core.XSDPart.GetDistinguishedField(String dottedPath)

        at SCInputSchemas.SCOrches.segment1(StopConditions stopOn)

        at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)

         

        For more information, see Help and Support Center at

         

        what I want to do is I have to read the value in those elements and then decide if they are not null. I am trying to do this please tell me that my approach is correct or wrong. I have created another message where I will map my request message to it and set these data types to boolean so if there is a value in those elements then I will transform them to a boolean in my own message that I have created, but i am not able to find the exact functoids to use in the transformation and if this is easy way to solve this can you please tell me what all functoids should I use to convert any data type into boolean.

         

        Thanks

         

         

         

        • #21114

          So you want to check the fields for null in a map?  In that case, maybe you don’t need a decide shape.  The mapping approach could work.  You can use a string size functoid to get the length of the field you want to check for null.  Use a greater than functoid to determine whether the length is greater than 0.  Connect the greater than functoid to a value mapping functoid.  Now add another parameter to the value mapping functoid.  For the parameter, enter the constant value of “1” (true).  Connect the value mapping functoid to the boolean field in your destination schema.  Now a 1 will be mapped if the field in the source schema is not null.  To map a 0 if the field is null, add a logical not functoid connected to the greater than and another value mapping with a “0” parameter.  That is the approach that I would try.

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