Jahia Documentation > With jcr:sql, how...

0 (0 Good)
0 (0 Bad)

With jcr:sql, how to filter a node on a property choicelist multiple weakreference

by  axel.pesme@softeam.fr »  2018/05/31 15:58

Hello,

I have this three nodes in my definitions.cnd

[slamnt:country] > jnt:content, slammix:slam
 - name (string) mandatory internationalized
 - code (string, choicelist[resourceBundle]) = 'ch' mandatory < 'fr', 'lu', 'ch', 'de', 'at'
[slamnt:fund] > jnt:content, slammix:slam
 - name (string) mandatory
 - country (weakreference, choicelist[nodes='$currentSite/contents/country//*;slamnt:country']) multiple
[slamnt:listFund] > jnt:content, slammix:slam
+ * (slamnt:fund)

so in a slamnt:fund, I select in the country choicelist for example : "fr lu ch"
and in another slamnt:fund, I select : "de"

later in my listFund.jsp, i have a jcr:sql with that query :

<c:set var="queryStatement" value="select * from [slamnt:fund] as fund where ISDESCENDANTNODE(fund,'${currentNode.path}') order by fund.name asc"/>
<jcr:sql var="result" sql="${queryStatement}"/>

this is working fine. But, i want to filter the fund with their country. Somewhere else in my site, i have choosen the country "fr".
how can I select only the funds which have a slamnt:country fr selected in the country choicelist ?
i have tested :

<c:set var="queryStatement" value="select * from [slamnt:fund] as fund where ISDESCENDANTNODE(fund,'${currentNode.path}') and fund.country = \"fr\" order by fund.name asc"/>

but it's not working, I have also try several alternatives like :

fund.country.code = "fr"
contains (fund.country, "fr")
fund.country = '${countrySelected}'
fund.country like '%${countrySelected}%'

but none is working.

How can i do this ?

  (axel.pesme@softeam.fr)

Number of messages  4
Registration date
Contact
Share
Feedback

Get in touch

Whether you are a current user or if you are just evaluating Jahia, we are here to help.

Contact us

Share this page