IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

distinct-values in XQuery

  • 1.  distinct-values in XQuery

    Posted Mon October 01, 2007 08:37 AM

    declare namespace xs=‘XML Schema
    let $listKeys := distinct-values(
    for $b in input()/oDocument [
    /oDocument/@type=‘Element’
    and /oDocument/@parent = ‘C13ECC62C52B8000’]
    /attributes/attribute
    where $b/@key=‘C13ED8481ECA0000’ and $b/text() != 123
    return $b/@oDocKey
    )

    return $listKeys

    This example works
    /*-------------------------------------------------------------------

    And here this returns a error

    declare namespace xs=‘XML Schema
    let $listKeys := distinct-values(
    for $b in input()/oDocument [
    /oDocument/@type=‘Element’
    and /oDocument/@parent = ‘C13ECC62C52B8000’]
    /attributes/attribute
    where $b/@key=‘C13ED8481ECA0000’ and xs:int($b/text()) != 123
    return $b/@oDocKey
    )

    return $listKeys

    Conversion error for comparison The source type is: anySimpleType, the target type is: double.

    /*------------------------------------------------------------------
    In what a problem?


    #webMethods
    #API-Management
    #Tamino


  • 2.  RE: distinct-values in XQuery

    Posted Tue October 02, 2007 09:25 PM

    An initial comment: you don


    #API-Management
    #Tamino
    #webMethods


  • 3.  RE: distinct-values in XQuery

    Posted Tue October 09, 2007 08:19 AM

    I thought that too, but it works like this!

    declare namespace xs='http://www.w3.org/2001/XMLSchema' 
    let $listKeys := ( 
    for $b in input()/oDocument [ 
    /oDocument/@type='Element' 
    and /oDocument/@parent = 'C13ECC62C52B8000'] 
    /attributes/attribute 
    where $b/@key='C13ED8481ECA0000' and xs:int($b/text()) != 123 
    return $b/@oDocKey 
    )
    return $listKeys

    And on sharing of function distinct-values(); and xs:int() gives out a mistake


    #API-Management
    #Tamino
    #webMethods


  • 4.  RE: distinct-values in XQuery

    Posted Thu October 11, 2007 08:14 PM


  • 5.  RE: distinct-values in XQuery

    Posted Tue October 16, 2007 10:03 AM

    Full text XQuery:

     
    declare namespace xs='http://www.w3.org/2001/XMLSchema' 
    let $oDocs := ( 
    for $b in input()/oDocument[
    /oDocument/@type='Елемент' and 
    /oDocument/@parent='C13ECC62C52B8000'
    ]/attributes/attribute  
    where ($b/@key='C13ED8481ECA0000' and $b/text()!= '123')
    return $b/@oDocKey) [position() >= 0 and position() <= 10] 
    
    return ($oDocs)

    OR

     
    declare namespace xs='http://www.w3.org/2001/XMLSchema' 
    let $oDocs := ( 
    for $b in input()/oDocument[
    /oDocument/@type='&#1045;&#1083;&#1077;&#1084;&#1077;&#1085;&#1090;' and 
    /oDocument/@parent='C13ECC62C52B8000'
    ]/attributes/attribute  
    where ($b/@key='C13ED8481ECA0000' and xs:int($b/text())!= 123)
    return $b/@oDocKey) [position() >= 0 and position() <= 10] 
    
    return ($oDocs)

    Result:

    • <xq:result xmlns:xq=“…”>
      <xq:value xmlns:xq=“…”>C14415073F3F0000</xq:value>
      xq:valueC14415088B088000</xq:value>
      xq:valueC14415090CEA8000</xq:value>
      xq:valueC14415090CEA8000</xq:value>
      xq:valueC1441509BC358000</xq:value>
      xq:valueC144150A0C498000</xq:value>
      xq:valueC144150A0C498000</xq:value>
      xq:valueC144150AA4E00000</xq:value>
      xq:valueC144150ACEDE0000</xq:value>
      xq:valueC144150B083D8000</xq:value>
      </xq:result>
    • <ino:cursor ino:handle=“1”>
      <ino:current ino:position=“1” ino:quantity=“10” />
      <ino:next ino:position=“11” />
      </ino:cursor>

    #webMethods
    #API-Management
    #Tamino


  • 6.  RE: distinct-values in XQuery

    Posted Wed October 17, 2007 10:49 PM

    I think at this point I would contact Software AG support. It looks like a bug.


    #Tamino
    #webMethods
    #API-Management