comparing 2 strings using XQuery in Tamino 4.1

Hi,

We are currently storing documents in Tamino that have a field called “dateOfService” of type xs:string and with the following format: YYYYMMDD (ex: 20030421).

I am looking to query for all documents that fall between some_starting_date and some_ending_date (both of which beeing of type xs:string and of the same format spcified above)

1. Can I use the xs:date(string) function? It seems to parse date with YYYY-MM-DD formats only.
2. Is the xf:compare(string, string) function implemented in Tamino 4.1?
3. The operators (=, < and >) don’t seem to work with strings.
4. I get a type exception when I do the following (probabily because some documents might have the dateOfService field blank)

for $a in input()/doc:revisionDoc
where xs:int($a/document/dateOfService) >= xs:int(20020101)
return { $a/@id }

Does anybody have some suggestions? Thank you for your help.

Eric

If I have some documents such as :



I can query for a specific date range using:

for $x in input()/dates
where $x/@date >= “20030410” and $x/@date <= “20030430”
return $x

To speed things up I can define a standard index on the date attribute.

Hope this helps.

Stuart Fyffe-Collins
Software AG (UK) Ltd.

yes this helps thank you