Applies to: the thread names no Clarion version and no template chain.
Problem
Template B should generate code conditionally, depending on whether template A has been added to the procedure or application.
Solution
Loop over %ActiveTemplate, compare the name in upper case, set a flag and leave the loop. The poster's own flag name here is %FOUND:
#SET(%FOUND,%FALSE)
#FOR(%ActiveTemplate)
#IF(UPPER(%ActiveTemplate) = 'WHATEVER(WHATEVER)')
#SET(%FOUND,%TRUE)
#BREAK
#ENDIF
#ENDFOR
Replace WHATEVER(WHATEVER) with the template's name and its parenthesised chain as it appears in the template registry, in capitals because the test uses UPPER. The original poster reported that this worked.
Caveats
- A second poster offered a shorter form, but its code was lost from the archived text, so it is not reproduced here.
- The first poster said a shorter form had failed for him some years earlier and he no longer used it; he could not recall when or why.
- The thread says nothing about reading
%ActiveTemplatefrom a global extension versus a procedure; it does not settle which scope the loop sees.
Today (2026)
Not re-tested. %ActiveTemplate is a long-standing template symbol and the loop likely still works; check it on your build before relying on it.
Sources: Leonid C. (Jan 2008, the question), Lee W. (Jan 2008), Mike H. (Jan 2008) in softvelocity.clarion.templates.