Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mhulse/6015438 to your computer and use it in GitHub Desktop.
Save mhulse/6015438 to your computer and use it in GitHub Desktop.
Caché 2009.1 - DTI Lightning 7.7.x: Get the latest entry from the SEOStoryLookup table.
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
<script language="cache" method="lookup" arguments='story:dt.cms.schema.CMSStory=-1' returntype="%String" procedureblock="1">
; Initialize result value:
set result = ""
; dt.cms.schema.CMSStory?
set:($isobject(story)) story = story.%Id() // Get its ID.
; Do we have a valid CMSStory ID?
if ($isvalidnum(story)) {
; Run the query:
try {
; Embedded SQL statement:
&sql(SELECT TOP 1 SEOStoryLookup.seoURL INTO :result FROM dt_cms_schema.SEOStoryLookup WHERE CMSStoryId = :story ORDER BY SEOStoryLookup.created DESC)
} catch(e) {
; What to log and where?
}
}
; Return result or empty string:
quit result
</script>
<csp:comment>
<csp:object name="gStory" classname="dt.cms.schema.CMSStory" objid="29615001">
#(##class(csp.rg.assets.methods.story).lookup(gStory))#
</csp:comment>
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment