Procedure extension template generated into unrelated procedure without #Prompt values

So I’ve added a very basic template, one of my own, which opens a file and fetches a record and then populates global variables with the values it fetches.

Filled in the template prompts.
Go into the embeds for the procedure and there is no code from the templated being generated. Weird.

Hit the Gen, Make & Run toolbar button and find the extension template code is being generated in a totally unrelated procedure. I have 1 procedure per module.

What gives? How do I sort this out or cant we use our own templates now?

You probably have a bug in your template, or you’ve added it in the wrong place, or whatever.
A good resource for help with this sort of thing (and the IDE in general) is the OpenClarion webinars every Wednesday (see because that’s a good, quick, way to ask questions and work through issues you are struggling with.

Obviously templates still work.

I found it added the procedure extension twice, one to the procedure I wanted it on, one to a totally unrelated procedure. The template code for the procedure I wanted it on, wasnt generated, but it was generated on the unrelated unwanted procedure, minus the filled prompts.

Here’s the template:
#Tab(‘Assign values before Open && Fetch file’)
#DISPLAY(‘Assign values to variables before opening’)
#Display(‘the settings file’)
#Button(‘Select variables to populate’),Multi(%AssignedVariables,%AssignedVariable &’ = ‘& %AssignedValue),Inline
#Prompt(‘Select Field to assign value:’,Field),%AssignedVariable,At(100)
#Display(’ Wrap values in ‘‘Single Quotes’’ ‘)
#Prompt(‘Assigned Values:’,Text),%AssignedValue,At(10)
#TAB(‘Load Settings into Globals’)
#DISPLAY(‘This template retrieves values from a single’)
#DISPLAY(‘record from a single file into global variables.’)
#DISPLAY(‘Use in conjunction with template IS_LoadFormSettings’)
#DISPLAY(‘Use with the ABC Source procedure.’)
#Prompt(‘Select Settings File:’,File),%SettingsFile,At(100)
#Prompt(‘Select Record ID Field:’,Field(%SettingsFile)),%SettingsField,At(100)
#Prompt(‘Select Primary Key to lookup:’,Key(%SettingsFile)),%SettingsKey,At(100)
#Prompt(‘Open/Close File:’,Check),%OpenCloseSettingsFile,At(10),Default(1)
#Button(‘Select Fields to populate’),Multi(%SettingsFields,%GlobalField &’ = ‘& %LoadSettingsField),Inline
#Prompt(‘Select Global Field:’,Field),%GlobalField,At(100)
#Prompt(‘Select Field to populate:’,Field(%SettingsFile)),%LoadSettingsField,At(100)
#AT(%ProcessedCode),PRIORITY(5000),Description(‘IS_LoadSettings - Open ‘& %SettingsFile &’ and Fetch Record’)
!IS_LoadSettings - Open File
%SettingsField = 1

#AT(%ProcessedCode),PRIORITY(5100),Description(‘IS_LoadSettings - Assign Settings’)
%GlobalField = %LoadSettingsField

#AT(%ProcessedCode),PRIORITY(5200),Description('IS_LoadSettings - Close '& %SettingsFile )
!IS_LoadSettings - Close File

lots of ways to debug this, but I’d suggest putting

! Richard: OpenCloseSettingsFile = %OpenCloseSettingsFile

immediately after the #AT statements.
Seems like if this setting is blank, or 0, then your code won’t generate.

The code that generated in another procedure, generates the code minus the filename, record id and primary key.

I’ve just knocked up a C11 version and changed the #AT(embed) to a different one and there doesnt seem to be any error handling in Clarion to handle templates where embeds used in an #AT() dont exist.

Edit. The other problem I found admitedly in C6 if not earlier, is where two or more #AT(), Priority() are used pointing to the same location with the same priority, they dont display in the embeds in the order they are defined/declared in the template.

eg if this

then they dont appear in the embeds in this order, its a random order. There should be some consistency matching the order declared in the template.

that’s not an error. Templates that support different situations are often set to write into embeds that might, or might not, exist in the procedure. For example I can write to Resizer embed points, so the code is only active if resizer exists.

If you want to know if an embed point exists, or not, then use the EXISTS function in the template language.

no, it should be inconsistent, so that you fix the PRIORITY…

It can’t be “made consistent” because there are many templates in play, all potentially writing to the same embed point. PRIORITY exists for a reason.

I agree on the priority, not disputing that, but where #AT()'s exists with the same priority, then surely it would make sense to have them in population order?

Point I noticed with the Resizer template, seeing as you mention it, it allows Tabs to be selected and have a resize strategy and they cant be resized, so the template could just not include tabs in the list of controls which could be resized.