I am following the instructions for the example of creating a template on page 81 of the manual.
I am at the point of selecting the Add a prefix to all columns names from the menu item (on page 86 of the manual), but the script will not run. There is no dialog box, the column names are not changing. I have placed an alert at the beginning of the OnClick function, it does not display.
Attached is the file of screenshots and detail description.
The contents of the Text tab:
// function Main adds on start of the application a menu item
// Add a prefix to all column names... into the Add-ins
// menu, that will call script OnClick from the
// AttrAddPrefix template upon its activation.
function Main()
{
MenuManager.AddMenuItem(&Add a prefix to all column namesW...,AttrAddPrefix,OnClick);
};
function OnClick()
{
Alert( Be Happy...I am running! );
if ((typeof(Model) == undefined) || (
Model.DatabaseId != 330))
SysUtils.Alert( Open or select a model for Firebird before adding prefixes to column names. );
else
AddPrefix();
};
// function for adding a prefix before all column names
function AddPrefix()
{
var e,a,add_pre;
// A value of the variable add_pre will be filled by the
// value of Toadä Data Modelers User Defined Variable AddPrefix.
// This will be explained in next chapter.
Model.ReadOnly = false;
for (e=0; e{
Entity = Model.Entities(e);
add_pre = Entity.GetUserVariable(AddPrefix);
if ( (add_pre != ) && SysUtils.Confirm( Should I add the \+add_pre+ \ prefix to all column names in Entity \+Entity.Name+\ ? ) )
{
for (a=0; a{
Attribute = Entity.Attributes(a);
if (Attribute.ColName.substr(0,add_pre.length) != add_pre)
Attribute.ColName = add_pre + Attribute.ColName;
}
}
};
Model.ReadOnly = true;
Alert( Finished successfully. );
};
The problem is in the name of the script/template.
See the first screenshot and name Template1.
However, in the script, main function, there is:
function Main()
{
MenuManager.AddMenuItem(&Add a prefix to all column namesW...,AttrAddPrefix,OnClick);
};
In the script, some other name is called - AttrAddPrefix.
The problem is in the name of the script / template.The user should rename Template1 to AttrAddPrefix. Then it should work properly.
This information is not stated in the users manual (tdm_manual.pdf). In particular on page 81, item 4 should explicitly state to enter AttrAddPrefix in the Name field and how this field corresponds to the
MenuManager.AddMenuItem call.
© 2025 Quest Software Inc. ALL RIGHTS RESERVED. Terms of Use Privacy Cookie Preference Center