Applies to: an ABC extension template; the thread names no Clarion version.
Problem
A small extension template adds global data and, in two window-event embeds (OpenWindow and AlertKey), code that shows the procedure name. After the template is removed from the procedure, the code still compiles and runs. The global variable stays after the code is gone. Bought templates remove their code, and the poster asked how.
Solution
- Do an unconditional regenerate first. The poster's first answer was "Shouldn't" remain, and after he did one, the code was gone. Before that, opening the embed in View Source and recompiling had also cleared it.
- The global data was a different matter. Anything declared in #GLOBALDATA or #LOCALDATA is no longer attached to the template, so it stays.
- Declare the data in an embed instead, so it stays attached to the template:
#AT(%DataSection),PRIORITY(4000)
GLO:MyCurrentProcName STRING(64)
#ENDAT
The poster confirmed this works.
Caveats
- Data declared through a data embed is attached to the template but is not available to designers such as the Window or Report designer.
- #GLOBALDATA does not duplicate lines when the template is used more than once or several templates use it; #AT(%DataSection) can duplicate lines in that case. This may not matter for a single-use template.
Today (2026)
Likely unchanged; not re-tested on a current build.
Sources: Andy M. (Jan 2021, the question), Lee W., Carl S. (Jan 2021) in softvelocity.clarion.templates.