5 Replies Latest reply: Jan 21, 2013 3:52 PM by vladodias RSS

    How to send multiple data for a single element

    BK574
      Hi All,

      I have a requirement where I have to send multiple data for single element per single transaction. For example

      Id details
      _ _____
      1 abcd
      1 efgh
      1 def

      Now, when I am selecting this ID from database, I have to get all the details in a single xsd like
      <id>1</id>
      ---><details>abcd</details>
      <details>efgh</details>
      <details>def</details>
      Thanks
        • 1. Re: How to send multiple data for a single element
          983134
          hi kamesh
          I think Ur requirement might be a bit different

          But the question You have asked is not so clear. . .

          if your requirement is to insert the details along with the id in to the database and to retrieve . . . .
          You can go ahead. . . no issues in our SOA will stop u . .

          Let me know where You are struck while doing this process. . .
          • 2. Re: How to send multiple data for a single element
            BK574
            Hi,

            Thanks for your response. I am not inserting values into database, I am retrieving the values from database.

            Thanks
            • 3. Re: How to send multiple data for a single element
              vladodias
              Hi,

              You can do that in two steps, firstly you read from the database with DbAdapter and get the data in this format...
              <root>
              <entry>
              <id>1</id>
              <details>abcd</details>
              </entry>
              <entry>
              <id>1</id>
              <details>efgh</details>
              </entry>
              ...
              </root>

              Then you use a xslt transformation using distinct-values to convert it to your final document...

              Hope this helps...

              Cheers,
              Vlad
              • 4. Re: How to send multiple data for a single element
                BK574
                can you give me an example of including distinct value function into bpel code.

                Thanks
                • 5. Re: How to send multiple data for a single element
                  vladodias
                  Hi,

                  The following XSLT...
                  <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
                  <xsl:template match="/">
                  <xsl:variable name="root" select="/"/>
                  <root>
                  <xsl:for-each select="distinct-values(/root/entry/id)">
                  <xsl:variable name="id" select="."/>
                  <entry>
                  <id><xsl:value-of select="$id"/></id>
                  <xsl:for-each select="$root/root/entry[id = $id]">
                  <details><xsl:value-of select="details"/></details>
                  </xsl:for-each>
                  </entry>
                  </xsl:for-each>
                  </root>
                  </xsl:template>
                  </xsl:stylesheet>
                  Will work for a document like this...
                  <root>
                  <entry>
                  <id>1</id>
                  <details>detail1</details>
                  </entry>
                  <entry>
                  <id>1</id>
                  <details>detail2</details>
                  </entry>
                  <entry>
                  <id>2</id>
                  <details>detail3</details>
                  </entry>
                  </root>
                  Hope this helps...

                  Cheers,
                  Vlad