简体   繁体   中英

How to parse unresolved result set in Tibco BW JDBC palette

I need to connect to remote MS SQL server stored procedure from Tibco BW JDBC palette to retrieve a result set where we won't be knowing the result set column names.

In my local environment I had mocked the procedure to return the expected result set but with dummy column names. Hence while parsing the unresolvedResultSet, error is thrown if the column name in the result set is other than the one defined in the output.

If i use 'result set as schema' option then also its throws error while parsing the result set if the column name is different.

Is there any way to fix this in Tibco BW?

Thanks in Advance.

For me sounds like converting procedure output UnresolvedResultsets to column/value schema can help to resolve your issue. You can use standard "Transform XML" activity for transforming $JDBC-Procedure/resultSet/UnresolvedResultsets to column/value schema

Step1 create XSLT file with following content:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:str="http://exslt.org/strings" 
xmlns:tns="http://www.*****.com/DMS/Core/Schemas/Index/Schema.xsd" 
version="2.0">
   <xsl:output method="xml" encoding="UTF-8" indent="yes" />
   <xsl:template match="/">
    <xsl:element name="ROOTELEMENT">
     <xsl:for-each select="//node()[not(exists(child::*))]">
        <xsl:if test="name()">
           <xsl:element name="Column">
              <xsl:element name="Name">
                 <xsl:value-of select="name()" />
              </xsl:element>
              <xsl:element name="Value">
                 <xsl:value-of select="." />
              </xsl:element>
           </xsl:element>
           </xsl:if>
         </xsl:for-each>
      </xsl:element>
   </xsl:template>
</xsl:stylesheet>

Step 2 add "Transform XML" activity and specify created in step 1 xslt file as Stylesheet 第2步

Step3 map $JDBC-Procedure/resultSet/UnresolvedResultsets to Transform XML input 第三步

The result should be like this: 在此处输入图片说明

here is link to transform XML tutorial

You can try ParsigXML using an "Any Element":

看到输入是UnresolvedSet

and this is the output i am parsing by:

在此处输入图片说明

Hope it works for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM