Created
September 18, 2014 19:00
-
-
Save mhulse/33bb98b29f08bc1e2a10 to your computer and use it in GitHub Desktop.
Caché 2009.1 - NEWSCYCLE Solutions: DTI Lighting 7.7.x: Get CMSStoryPubTracking StartDate CSP methods.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script language="cache" method="cmsPubTracking" arguments='cmsStory:dt.cms.schema.CMSStory=-1, latest:%Integer=0' returntype="%TimeStamp" procedureblock="1"> | |
set return = "" | |
; By default, get the oldest entry: | |
set order = $case(latest, 1:"DESC", :"ASC") | |
try { | |
; See Roberto's and Sungung's replies: | |
; https://groups.google.com/d/topic/intersystems-public-cache/yKft-NK826I/discussion | |
; https://groups.google.com/d/topic/intersystems-public-cache/DH1fQOzwPiM/discussion | |
set sql = "SELECT StartDate FROM dt_cms_schema.CMSStoryPubTracking WHERE CMSStory = ? ORDER BY StartDate " _ order | |
set (sc1, sc2, sc3) = -1 | |
set rs = ##class(%ResultSet).%New() | |
set sc1 = rs.Prepare(sql) | |
if ($$$ISOK(sc1)) { | |
set sc2 = rs.Execute(cmsStory.%Id()) | |
if ($$$ISOK(sc2)) { | |
do rs.%Next(.sc3) | |
set:($$$ISOK(sc3)) return = rs.GetData(1) | |
} | |
} | |
} catch(e) { | |
; What to log and where? | |
} | |
quit return | |
</script> | |
<csp:comment> | |
<csp:object name="gStory" classname="dt.cms.schema.CMSStory" objid="27846880"> | |
#(..cmsPubTracking(gStory))# | |
<br> | |
#(##class(csp.rg.assets.methods.datetime).timesince(##class(csp.rg.assets.methods.datetime).cmsPubTracking(gStory)))# ago. | |
</csp:comment> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment