The crux of the problem is how checkbox values are stored. Other controls simply write a single value to a nodeData and they're done. For those, expressions like //[EMAIL PROTECTED]'News'] would work. Checkboxes are different in they write a contentNode and each checked value is written as a nodeData underneath using the same parlance used to name paragraphs in a paragraph collection.

Example:

myPage
 +- pageCategory
     +- 0  'Value 1'
     +- 1  'Value 2'
     +- 2  'Value 5'
     +- 3  'Value 8'

So what we're after for an XPath expression is:


//*[pageCategory/@*='News']

This returns all nodes containing a pageCategory, further for the set of all nodes containing a pageCategory, the pageCategory node contained within must contain at least one nodeData with the value 'News'. To verify in version 3.0.x, simply take a look at your page in the JCR Browser and to test the query, drop it in to the query tool to see the result set.

Sorry, but I don't know how to do the SQL version of this.

--David


Skip Strickland wrote:
Dieter,

Can you try the "and" operator?

        //element(*, nt:unstructured) [(@title = 'salesDollars') and (@total > 
1000) ]

Also the "not" operator:

        //element(*, nt:unstructured) [(@title = 'salesDollars') and not 
(@state = 'Florida') ]



Some references I study:
        http://www.w3schools.com/xpath/xpath_syntax.asp (especially helpful)
        http://www.w3.org/TR/xquery
        http://www.w3.org/TR/xpath
        
        

Can anyone else offer some links on XPATH, XQUERY, and SQL comparisons?


Skip



-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]
Sent: Monday, April 30, 2007 12:59 AM
To: [email protected]
Subject: Re: [magnolia-user] Sql Queries on select control type



Thanks Skip,

This works for single-value properties, but not for my multi-value
properties. Any Ideas?

Dieter



Magnolia - User mailing list wrote:
This works for me...


//element(*, nodeType) [EMAIL PROTECTED] = 'propertyValue']

        for example:
//element(*, nt:unstructured) [EMAIL PROTECTED] = 'salesDollars']


Hope this works,

Skip






-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]
Sent: Friday, April 27, 2007 7:43 AM
To: [email protected]
Subject: Re: [magnolia-user] Sql Queries on select control type



Well i actually found some assistance on the JCR forum for this, but i am
still having no luck which is quite irritating as they seem convinced it
should work.

//[EMAIL PROTECTED] = 'News'] should be the right solution? I have gone
through the entire specification documentation and am now at wits end.

Can anybody please help!!

Dieter


dieter wrote:
Hi,
I am trying to run a query on a news item where i have assigned one or
many categories. The categories are assigned in a dialog and use a
checkbox control to be assigned.

Now i understand how simple queries work as in the sample, but how do i
query a multiselect value as in my example above.

When i looked in the exported xml, it is stored as a node instead of a
property (as other standard text entry items are).

<sv:node sv:name="pageCategory">
    <sv:property sv:name="jcr:primaryType" sv:type="Name">
      <sv:value>mgnl:contentNode</sv:value>
    </sv:property>
    <sv:property sv:name="jcr:mixinTypes" sv:type="Name">
      <sv:value>mix:versionable</sv:value>
    </sv:property>
    <sv:property sv:name="jcr:uuid" sv:type="String">
      <sv:value>a6f7ba18-aec8-4d39-b43f-7f9b7e387408</sv:value>
    </sv:property>
    <sv:property sv:name="0" sv:type="String">
      <sv:value>news</sv:value>
    </sv:property>
    <sv:node sv:name="MetaData">
      <sv:property sv:name="jcr:primaryType" sv:type="Name">
        <sv:value>mgnl:metaData</sv:value>
      </sv:property>
      <sv:property sv:name="jcr:uuid" sv:type="String">
        <sv:value>4e563fc3-3e72-4bc3-ab34-5f932b0af9ff</sv:value>
      </sv:property>
      <sv:property sv:name="mgnl:creationdate" sv:type="Date">
        <sv:value>2007-04-26T12:38:16.443+01:00</sv:value>
      </sv:property>
    </sv:node>
  </sv:node>


Thanks,

Dieter

--
View this message in context:
http://www.nabble.com/Sql-Queries-on-select-control-type-tf3651160.html#a10220164
Sent from the Magnolia - User mailing list archive at Nabble.com.


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------

----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------





--
David Smith
Network Operations Supervisor
Department of Entomology
Cornell University
2132 Comstock Hall
Ithaca, NY 14853
Phone: (607) 255-9571
Fax: (607) 255-0940


----------------------------------------------------------------
for list details see
http://www.magnolia.info/en/developer.html
----------------------------------------------------------------

Reply via email to