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
  • 1.  Limit the number of results

    Posted Wed September 28, 2005 12:18 PM

    Hello,

    I have an XQuery which returns me all documents with a certain value in the name-element and sorts them by a date and time given in elements in the documents. Everything works fine, but now I want to limit the number of returned documents e.g. to 5.

    How can I accomplish this?

    Thanks in advance,
    Jo Richter


    #API-Management
    #Tamino
    #webMethods


  • 2.  RE: Limit the number of results

    Posted Wed September 28, 2005 12:44 PM

    e.g. in the followinig way:

    (your XQuery here)[position() le 5]


    #API-Management
    #webMethods
    #Tamino


  • 3.  RE: Limit the number of results

    Posted Wed September 28, 2005 12:55 PM

    Thanks for the very quick response.

    I tried it with position() already, it doesn’t work. With the query:

    declare namespace tf=“http://namespaces.softwareag.com/tamino/TaminoFunction
    declare namespace mtaresult=“http://www.mt.com/2005/xmlns/testresult
    declare namespace xs=“XML Schema
    for $myinput in input()/mtaresult:testresult
    where $myinput/mtaresult:testplan/mtaresult:name=‘plan example’
    return $myinput[position() le 5]

    I still get all documents (I dropped the sort by expression for simplicity).

    Why, do I do something wrong!?

    Greetings,
    Jo Richter


    #webMethods
    #API-Management
    #Tamino


  • 4.  RE: Limit the number of results

    Posted Wed September 28, 2005 03:49 PM

    Yes, please add parantheses:

    (declare namespace tf=“http://namespaces.softwareag.com/tamino/TaminoFunction
    declare namespace mtaresult=“http://www.mt.com/2005/xmlns/testresult
    declare namespace xs=“XML Schema
    for $myinput in input()/mtaresult:testresult
    where $myinput/mtaresult:testplan/mtaresult:name=‘plan example’
    return $myinput)[position() le 5]


    #webMethods
    #API-Management
    #Tamino


  • 5.  RE: Limit the number of results

    Posted Wed October 05, 2005 09:07 AM

    Hello,

    I was able to test it yesterday and it worked fine, so thank you very much for solving my problem!

    Greetings,
    Jo Richter


    #Tamino
    #webMethods
    #API-Management