Skip to main content

contentSelect with cms_value_param not working?

Comments

5 comments

  • Zendesk API User
    Author: marro - 6/25/2018 13:36

    Hi Jan,

    you functions do look good at first view. But I think you can't convert the value of the CMS_CDATA_PARAM to a Boolean. So I replaced (and simplified ;-) ) your first function by

    <CMS_FUNCTION name="define" resultname="qf_brand"> 

      <CMS_VALUE_PARAM name="source" value='ss_brand.equals("streetone")'/> 

    </CMS_FUNCTION>

    This still hasn't worked, but by changing the datatype of the FILTERPARAM from Boolean to String finally got it working.

    Best regards

    Donato

    0
  • Zendesk API User
    Author: jan_bogutzki - 6/25/2018 14:42

    Hi Donato,

    thanks for your reply. This works, but additionally we have a problem with the value null. The solution is not extendable to use null as value for this boolean comparsion.

    Would be great to use conditions in the query, just to replace such hack with define-Variables.

    best regards

    Jan

    0
  • Zendesk API User
    Author: marro - 6/25/2018 15:40

    Well, here is a solution without define and also working with null values ;-)

    <CMS_FUNCTION name="contentSelect" resultname="cs_blogs_so"> 

      <CMS_PARAM name="schema" value="Blogs" /> 

      <CMS_VALUE_PARAM name="qf_brand" value='ss_brand.equals("streetone")' /> 

       <QUERY entityType="blog" limit="50">

         <FILTERPARAM parameter="qf_brand" datatype="java.lang.String" value="1"/>

         <OR>

           <EQ attribute="brand" parameter="qf_brand" /> 

           <IS_NULL attribute="brand" />

         </OR>

         <ORDERCRITERIA attribute="date" descending="1"/>

      </QUERY> 

    </CMS_FUNCTION>

    Best regards

    Donato

    0
  • Zendesk API User
    Author: marro - 6/25/2018 15:43

    You can of course combine EQ also with NOTNULL and using AND and/or OR in combination to get the result that you want.

    0
  • Zendesk API User
    Author: jan_bogutzki - 6/26/2018 5:34

    Hi Donato,

    Thanks for your reply. The check if there is a null value only is required when testing for a false-Value. Thats the case i need a condition, because when true is tested, there must not be a null value result.

    best regards

    Jan

    0

Please sign in to leave a comment.