Last active
August 29, 2015 14:06
-
-
Save mhulse/633f47c79ce671aae1b5 to your computer and use it in GitHub Desktop.
Caché 2009.1 - NEWSCYCLE Solutions: DTI Lighting 7.7.x: Get sub/category name 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
<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")) { // Should I check SQLCODE also? | |
//---------------------------------- | |
// Category? | |
//---------------------------------- | |
&sql(select categoryName into :return from dbo.Category C where C.categoryId = :id) | |
} else { | |
//---------------------------------- | |
// RG-specific category name fixes: | |
//---------------------------------- | |
set return = ..fix(return) | |
} | |
} | |
//---------------------------------- | |
// Return: | |
//---------------------------------- | |
quit return | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment