Skip to content

Instantly share code, notes, and snippets.

@mhulse
Created September 4, 2012 23:53
Show Gist options
  • Save mhulse/3628229 to your computer and use it in GitHub Desktop.
Save mhulse/3628229 to your computer and use it in GitHub Desktop.
Caché DTI ContentPublisher: Tested in 7.6, 7.7.X: Get category/subcategory name...
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
<csp:comment>
/// @param: Category/subcategory id. Required.
/// @return: Category/subcategory name.
</csp:comment>
<script language="cache" method="catName" arguments='id:%String=""' returntype="%String" procedureblock="1">
//----------------------------------
// Initialize:
//----------------------------------
set return = ""
if ($length(id)) {
//----------------------------------
// Subcategory?
//----------------------------------
&sql(select subCategoryName into :return from dbo.SubCategory SC where sc.subCategoryId = :id)
if (( ' $length(return)) || (return = "-") || ($zconvert(return, "U") = "NONE")) {
//----------------------------------
// Category?
//----------------------------------
&sql(select categoryName into :return from dbo.Category C where C.categoryId = :id)
}
}
//----------------------------------
// Return:
//----------------------------------
quit return
</script>
<csp:comment>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</csp:comment>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment