Testing a Date Standard Field

38 views
Skip to first unread message

Dave R

unread,
Aug 22, 2011, 12:53:22 PM8/22/11
to RedDot CMS Users
Hey,
I need a way to test to see if a date has been set in a standard field
using render tags. I've tried testing based on length and on elements
that are empty, it still returns the same results. The test is
determining if a manual date has been entered otherwise it will
default to a system date based on the last release time.

Here's the code that I'm working with:


<reddot:cms>
<if>
<query valuea="Context:CurrentPage.Elements.GetElement(<
%stf_Article_RSS_Date%>).Value.Length" operator="==" valueb="29">
<htmltext>
<pubDate><%stf_Article_RSS_Date%></pubDate>
</htmltext>
</query>
<query type="else">
<htmltext>
<pubDate><%info_itemdate%> </pubDate>
</htmltext>
</query>
</if>
</reddot:cms>


Right now, that test will always fail resulting in <%info_itemdate%>
rather than <%stf_Article_RSS_Date%>

The date's string format is: ddd, dd MMM yyyy hh:mm:ss EST

So, what am I doing wrong here?

Tony Gayter

unread,
Aug 22, 2011, 1:12:03 PM8/22/11
to reddot-c...@googlegroups.com
Your
Context:CurrentPage.Elements.GetElement(<%stf_Article_RSS_Date%>)

is incorrect, it can either be
Context:CurrentPage.Elements.GetElement(stf_Article_RSS_Date)
or
<%stf_Article_RSS_Date%>

try the following, although Im not sure what the 29 stands for

<reddot:cms>
 <if>
   <query valuea="Context:CurrentPage.Elements.GetElement(stf_Article_RSS_Date).Value" operator="==" valueb="29">

Jian Huang

unread,
Aug 22, 2011, 1:53:14 PM8/22/11
to RedDot CMS Users
Hi guys,

Just a word of caution that rendertag getelement has caching issues,
meaning the rendertag will return cached data despite updates to
stf_article_rss_date, unless the cache of the entire page is
refreshed.

I would recommend to go with Tony's second suggestions, to use
placeholder directly within the if conditional rendertag.

Best,

-Jian
Reply all
Reply to author
Forward
0 new messages