none
Existance of the element and child element RRS feed

  • Question

  • Hi All,

    I want to check that input message is having existence of the Element and if exist then map to specific node of destination schema.

    Source Message (Structure) is as follows :

    Error

           Code

           Details

    I want to check that if input message is not having Error element in it then in destination schema map value as Code=0 and Details ="Success"

    If element is in input message and having value in it then code=100 and Details="Fail".

    How to do this ? i tried using logical existence but it's work only in case of if i(Error) element exist in input message.

    But if i remove Error element it's not setting 0 and "Success".


    Thanks and Regards, Nitin.

    Wednesday, October 14, 2015 9:00 AM

Answers

  • Ok then , you need to use Record Count Record , if you check the xsl file you will understand the issue

    it was using for-each, this is the reason that it is not creating the node


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    • Marked as answer by Nitin Surya Thursday, October 15, 2015 12:36 PM
    Thursday, October 15, 2015 11:58 AM

All replies

  • You provided a destination structure not a source, Right?

    Can you provide source and destination schema structure as xml code?


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    Wednesday, October 14, 2015 9:09 AM
  • It should look like this, it works fine


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    Wednesday, October 14, 2015 9:20 AM
  • Hi,

    You can use the following logic for your requirement:

    • Use the "Logical Existence" functoid to check if the node "Error" exist or not.
    • If it exist, then use the "Value mapping" functoid to map the value to the destination.
    • If it does not exist, use the "Logical NOT" functoid to check if the node does not exist.
    • Use the value mapping to set the values in case of Not Exist

    Please indicate "Mark as Answer" or "Mark as Helpful" if this post has answered the question

    Rahul

    Wednesday, October 14, 2015 9:28 AM
  • Hi Nitin,

    You can refer below MSDN blog for the use of logical existence and value mapping functoid.

    Its simple if else condition in BizTalk mapper . You can read below post to get the basic understanding clear .

    http://blogs.msdn.com/b/chrisromp/archive/2007/05/29/to-be-or-logical-not-to-be.aspx

    Thanks
    Abhishek

    Wednesday, October 14, 2015 9:54 AM
  • Hi Thanks  Suleiman,

    This is not working me as 1) Error node in source schema is unbounded.

    i have t check that if code element is exist then check that it's having some value in it.

    If yes then only set code = 100 and Details = "Failed" else code =0 and Details = Success.

    In my case in input instance if i add the element  <error> <code>10</code><Details>Test<Details></error>

    Then output is coming as  <error> <code>100</code><Details>Failed<Details></error>

    If input instance(message) is no <error> in it then this fails cause Error node is required in Destination schema and expecting something.

    Also would like to update that in Source schema field code is Required but parent node of code (error) is minoccure = 0 in source schema.

    please help me to resolve this issue.


    Thanks and Regards, Nitin.

    Thursday, October 15, 2015 11:11 AM
  • Ok then , you need to use Record Count Record , if you check the xsl file you will understand the issue

    it was using for-each, this is the reason that it is not creating the node


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer

    • Marked as answer by Nitin Surya Thursday, October 15, 2015 12:36 PM
    Thursday, October 15, 2015 11:58 AM
  • Hi Suleiman...

    that worked for me it's working fine thanks....


    Thanks and Regards, Nitin.

    Thursday, October 15, 2015 12:36 PM