The Story of a Homegrown Clarion Template

by Stu Andrews on April 24, 2007

in Blog

The simplest template in my arsenal is the one you’d find most in the code.

I discovered early on it was a good idea to send the (offending) Procedure Name through to the error logging.

_AddError('MyAwesomeProcedure','Stupid Error Subject','Stupid Error Body');

After too long, I decided to do something about always having to string type as a parameter to the error logging function.

But what to do? You’ve probably already seen what took me at least 2 years.

changing_strings

I wrote a little template that places a local var (_:ProcedureName) into every procedure in the app (globally added). This var is populated with the Procedure Name, and now i never have to change that parameter.


#!=========================================

#!= Logging Template 

#!=========================================

#TEMPLATE(SA_Logging,'Stus Templates: Logging, Errors and Otherwise'),FAMILY('ABC'),FAMILY('CW20'),FAMILY('Legacy')

#!

#!

#!-----------------------------------------------

#!-----------------------------------------------

#EXTENSION(Global_GetProcedureName,'Global Template to add the GetProcedureName template to each procedure'),APPLICATION(Local_GetProcedureName)

#DISPLAY('==========================================')

#DISPLAY('Global Template for GetProcedureName functionality')

#DISPLAY('==========================================')

#PROMPT('Disable GetProcedureName Code',CHECK),%NoGPNCode,AT(10)

#AT(%DataSection)

#IF(%NoGPNCode)

#ELSE

_:ProcedureName string('%Procedure')

#ENDIF

#ENDAT

#!-----------------------------------------------

#EXTENSION(Local_GetProcedureName,'_:ProcedureName == the Procedure Name'),PROCEDURE

#!-----------------------------------------------

Simple. Sweet. Saves me heaps of time.

Popularity: 2%

Related posts:

  1. Sibisy, The Simple Billing System
  2. Jamash, The Software to Rule
  3. New, Clarion, News
  4. Another Dotted Story
  5. The Fox (A Story of the Forest)

Leave a Comment

Previous post:

Next post: