Return-Path: Delivered-To: apmail-jackrabbit-users-archive@minotaur.apache.org Received: (qmail 51997 invoked from network); 1 Dec 2009 18:22:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Dec 2009 18:22:31 -0000 Received: (qmail 3407 invoked by uid 500); 1 Dec 2009 18:22:30 -0000 Delivered-To: apmail-jackrabbit-users-archive@jackrabbit.apache.org Received: (qmail 3384 invoked by uid 500); 1 Dec 2009 18:22:30 -0000 Mailing-List: contact users-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@jackrabbit.apache.org Delivered-To: mailing list users@jackrabbit.apache.org Received: (qmail 3373 invoked by uid 99); 1 Dec 2009 18:22:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Dec 2009 18:22:30 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [72.55.186.13] (HELO s010.panelboxmanager.com) (72.55.186.13) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Dec 2009 18:22:19 +0000 Received: from dsl-158-236.aei.ca ([66.36.158.236] helo=[192.168.0.195]) by s010.panelboxmanager.com with esmtp (Exim 4.69) (envelope-from ) id 1NFXMM-00060j-0X for users@jackrabbit.apache.org; Tue, 01 Dec 2009 13:21:58 -0500 Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Apple Message framework v1077) Subject: Re: Numeric/String comparisons in queries From: =?iso-8859-1?Q?Fran=E7ois_Cassistat?= In-Reply-To: <1259687451504-932301.post@n4.nabble.com> Date: Tue, 1 Dec 2009 13:21:41 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <3915B025-A9F1-4DE9-B259-344548F81443@maya-systems.com> References: <1259687451504-932301.post@n4.nabble.com> To: users@jackrabbit.apache.org X-Mailer: Apple Mail (2.1077) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - s010.panelboxmanager.com X-AntiAbuse: Original Domain - jackrabbit.apache.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - maya-systems.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Checked: Checked by ClamAV on apache.org Le 2009-12-01 =E0 12:10 PM, dave_gough a =E9crit : >=20 > Hi, >=20 Hi > I have a a String property stored in the repository, but would like to = query > it using conditional logic as if it were a number >=20 > I have tried to implement the Atom spec in JCR and allowed extensions = to be > added on an ad-hoc basis. In this case there are number of "meta" = fields > that extend the Atom model, but they are all saved as Strings in an = attempt > to keep it simple. >=20 > However I now want to find all Entries that have a width property > = 10000, > but the query below does an ASCII comparison, so 20 > 1000 >=20 > /jcr:root/element(*,atom:Entry)[./meta/width/@atom:value>'1000']=20 >=20 > I tried to spoof itby removing the single=3Dquotes around 1000 and = this gave > mixed results >=20 It's normal since @atom:value property is from string type. > /jcr:root/element(*,atom:Entry)[./meta/width/@atom:value>1000]=20 >=20 > Is there a function such as "jcr:to_number()" or something similar = that > coerces the property to be a number? Or does anyone have any = suggestions on > how to do compare strings as numbers >=20 There is a number function in standard XPath = (http://www.w3.org/TR/xpath#function-number), you can try : /jcr:root/element(*,atom:Entry)[number(./meta/width/@atom:value)>1000]=20= But I'm not sure it is supported in JCR/JackRabbit. > regards >=20 > Dave Gough >=20 > regards > --=20 > View this message in context: = http://n4.nabble.com/Numeric-String-comparisons-in-queries-tp932301p932301= .html > Sent from the Jackrabbit - Users mailing list archive at Nabble.com. Frank