AutoSlot Field Query

I am creating an AutoSlot that I want to pull in a specifc content type that has a text field (or check box property, not sure yet) e.g. the user checks the box and/or types in “Yes” and in turn the Autoslot populates the global template with a snippet template from that content type. This query:

select rx:sys_contentid, rx:sys_folderid from rx:erauGenRt where jcr:path like ‘//Sites/news/faculty-experts/’ and rx:fe  = 'Yes' 

Doesn’t seem to capture the correct content type utilizing that field? Am I missing something? Also, I would prefer it to be a check box (Yes or No type thing) would a similar query be used if say a Radio Button or Check box was used?

Thanks,
MJW

Can you confirm that “Yes” is a result of rx:fe? This could be confirmed by using this test query:


select rx:fe, rx:sys_contentid from rx:erauGenRt[LEFT] where jcr:path like '//Sites/news/faculty-experts/'

[/LEFT]

Hey Riley,
I ran the Rhythmyx query degugger and with:

select rx:fe, rx:sys_contentid from rx:erauGenRt[LEFT] where jcr:path like '//Sites/news/faculty-experts/'

I get:
Query is select rx:fe, rx:sys_contentid from rx:erauGenRt where jcr:path like ‘//Sites/news/faculty-experts/’
Elapsed time is 18 milliseconds

rx:fe rx:sys_contentid

When I run it with the query I first posted:

[select rx:sys_contentid, rx:sys_folderid from rx:erauGenRt where jcr:path like ‘//Sites/news/faculty-experts/’ and rx:fe  = 'Yes'

I get an error of:
Unexpected Exception
javax.jcr.query.InvalidQueryException: Encountered

[QUOTE=Rileyw;19790]Can you confirm that “Yes” is a result of rx:fe? This could be confirmed by using this test query:


select rx:fe, rx:sys_contentid from rx:erauGenRt[LEFT][COLOR=#333333] where jcr:path like '//Sites/news/faculty-experts/'

[/LEFT][/QUOTE]

Ah,

try

[LEFT]select rx:sys_contentid, rx:sys_folderid from rx:erauGenRt where jcr:path like '//Sites/news/faculty-experts/' and rx:fe like 'Yes'

[/LEFT]

Tried that and got simailra rsults but if I run:

select rx:fe, jcr:path from rx:erauGenRt

I get a result of:
Query is select rx:fe, jcr:path from rx:erauGenRt
Elapsed time is 48 milliseconds

rx:fe jcr:path
//Sites/news/faculty-experts/about
Yes //Sites/news/faculty-experts/articles/bloom
//Sites/news/faculty-experts/articles/federick-recascino
//Sites/news/faculty-experts/articles
//Sites/news/faculty-experts/expert/experts-mental-health
//Sites/news/faculty-experts/expert/experts-security
//Sites/news/faculty-experts/contact
//Sites/news/faculty-experts/archives
//Sites/news/faculty-experts/expert
//Sites/news/faculty-experts/expert/experts-human-factors

So I am assuing it is the way I have the query written that is cuainsg the problem based on the fact that it is grabbing the content type and the “yes” field in the debugger?

[QUOTE=Rileyw;19792]Ah,

try

[LEFT]select rx:sys_contentid, rx:sys_folderid from rx:erauGenRt where jcr:path like '//Sites/news/faculty-experts/' and rx:fe like 'Yes'

[/LEFT][/QUOTE]

Try surrounding

'Yes'

with % to make it

'%Yes%'

There may be white space causing your criteria not to match.

Thanks Riley, that didn’t work either, I did get this query to work correctly:

select rx:fe, jcr:path from rx:erauGenRt where rx:fe = 'Yes'

Thanka again,
Mike

[QUOTE=Rileyw;19794]Try surrounding

'Yes'

with % to make it

'%Yes%'

There may be white space causing your criteria not to match.[/QUOTE]

I have a side question, if are were to change that “yes” into a radio button e.g. check the box and the auto slot grabs the item how does that change the query below?

select rx:fe, jcr:path from rx:erauGenRt where rx:fe = 'Yes'

Did you have to change anything in particular, or did it just start working?

[QUOTE=mjweise;19796]I have a side question, if are were to change that “yes” into a radio button e.g. check the box and the auto slot grabs the item how does that change the query below?

select rx:fe, jcr:path from rx:erauGenRt where rx:fe = 'Yes'

[/QUOTE]

You shouldn’t have to change the query string to match a radio box since it should be storing the value as a string. I could be wrong though.

In regard to this query?

select rx:fe, jcr:path from rx:erauGenRt where rx:fe = 'Yes'

No, I simply had too many parameters in the query, a bit of overkill :slight_smile:

Works now and am testing the radio/check box option. Will report back if it works.
as alwasyt thanks for the help!
Mike

No problem – I feel like we’re improving this community as a resource by answering these questions.

I know it is a huge help to me and I am makimg every attempt to follow up with the code/template and or solution that worked for me. Hopefully it will assist someone donw the road.

By the way, using a yes/no dropdown/radio button in place of the “Yes” on the content type did not work with that query. I’m still working through it.

CYA
Mike

Not sure if this has anything to do with it, but remember that if you are using the yes/no keyword, the values are 0 and 1…

I think that may have a LOT to do with it.

Thanks, will check it out.
Mike

Looking at a content type with a sys_SingleCheckBox field. Querying the system reveals that the field value is saved as ‘true’ / ‘false’.

Was able to use the following query:

select rx:checkbox,rx:sys_contentid from rx: where rx:inheritObjects = 'true'

Ok, that did it, thank you. Just to recap for anyone who cares. :slight_smile: I am setting up a “faculty expert” to be listed in a global template. I used an Auto Slot that searches the site for a content type with this query:

select rx:fe, jcr:path from rx:erauGenRt where rx:fe = '1'

I then added a field to the content type called “rx:fe” with Radio Button choices of yes/no. The end user then can choose who they want listed in the global template by simply choosing the “yes” button in the content type.

Appreciate all the help and input!
Mike