webMethods

webMethods

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

Date query in XQuery

  • 1.  Date query in XQuery

    Posted Tue September 09, 2003 02:25 PM

    Can I compare an element (type xs:date) to being greater than a variable? My query looks like this:
    for $q in input()/PeriodControl
    where $q/FromDate > ‘2001-01-01’
    return $q
    I have tried various ways of specifying the date, but haven’t yet hit on the right one.
    If this is not possible, what type would you recommend we use for storing a date?


    #webMethods
    #API-Management
    #Tamino


  • 2.  RE: Date query in XQuery

    Posted Wed September 10, 2003 11:29 AM

    Have you tried:-

    where $q/FromDate > xs:date(“2001-01-01”)


    #webMethods
    #API-Management
    #Tamino


  • 3.  RE: Date query in XQuery

    Posted Wed September 10, 2003 02:08 PM

    Thanks, Mike - works like a charm - I had to declare the namespace first. So my full XQuery is:

    declare namespace xs=“XML Schema
    for $q in input()/PeriodControl
    where $q/FromDate > xs:date(“2001-01-01”)
    return $q


    #API-Management
    #webMethods
    #Tamino