# Naming Conventions

**URL:** <https://forums.toadworld.com/t/naming-conventions/2172>\
**Category:** Toad Data Modeler\
**Created:** [December 22, 2009, 8:39am UTC](https://forums.toadworld.com/t/naming-conventions/2172 "2009-12-22T08:39:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wbray](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@wbray](https://forums.toadworld.com/u/wbray)\
**Post date:** [December 22, 2009, 8:39am UTC](https://forums.toadworld.com/t/naming-conventions/2172/1 "2009-12-22T08:39:11Z")

</div>

I’d like to take this logical model:

* * *

| facility category |
| --- |

## facility category identifier 1:1 | | | 0:M

| facility |
| --- |

facility identifier

and create the following relational model:

* * *

| t\_fac\_cat |
| --- |

## fac\_cat\_id 1:1 | | | 0:M

| t\_fac |
| --- |

fac\_id   
fac\_cat\_id \<NN,FK\>

I’ve created the logical model and used ‘Simple Model Conversion’ to convert to Oracle 10g.

I then applied the following naming convention to the physical model:

General: Everything checked.  
Naming Convention Rules:  
‘entities’ prefix ‘t\_’ case ‘lowercase’  
‘attributes’ prefix none case ‘lowercase’  
Glossary Character Replacement: =\_ (i.e., =)  
Glossary Word Replacement:  
facility=fac  
category=cat  
identifier=id

and get:

* * *

| t\_facility\_category |
| --- |

## facility\_category\_identifier 1:1 | | | 0:M

| t\_fac |
| --- |

facility\_identifier   
facility\_category\_identifier \<NN,FK\>

The ‘t\_’ prefix worked. The space replacement with underscores worked. Entity ‘facility’ was abbreviated to ‘fac’. However, none of the other abbreviations were applied. It appears the space-\>underscore replacement occurs first and prevents the matching of the rest of the abbreviations. If that is what is happening, is there another way to get the naming I want?

Brian

---

<div class="post-metadata">

**Author:** ![DavidF](https://avatars.discourse-cdn.com/v4/letter/d/f07891/32.png) [@DavidF](https://forums.toadworld.com/u/DavidF)\
**Post date:** [December 22, 2009, 11:38am UTC](https://forums.toadworld.com/t/naming-conventions/2172/2 "2009-12-22T11:38:05Z")

</div>

You are absolutely right. The space-\>underscore replacement occurs first and prevents the matching of the rest of the abbreviations. We are planning to change this behaviour in the next release (CR #69743) .

Workarround is either to add all words into the glossary (e.g. facility category = fac\_cat ), that could be a lot of words or not to replace the space character with the underscore character in the naming convention rules and to run later a simple macro that would replace the space character with the underscore character.

Thank you for your remark.

David

---

<div class="post-metadata">

**Author:** ![wbray](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@wbray](https://forums.toadworld.com/u/wbray)\
**Post date:** [December 22, 2009, 12:38pm UTC](https://forums.toadworld.com/t/naming-conventions/2172/3 "2009-12-22T12:38:44Z")

</div>

David,

That’s good news that this issue is being addressed.

Thanks for your help.

Brian

---

<div class="post-metadata">

**Author:** ![wbray](https://avatars.discourse-cdn.com/v4/letter/w/4da419/32.png) [@wbray](https://forums.toadworld.com/u/wbray)\
**Post date:** [December 22, 2009, 2:09pm UTC](https://forums.toadworld.com/t/naming-conventions/2172/4 "2009-12-22T14:09:48Z")

</div>

David suggested:

“… or not to replace the space character with the underscore character in the naming convention rules and to run later a simple macro that would replace the space character with the underscore character.”

This works pretty well. Here’s the macro I created (i.e., hacked together from two existing macros) to replace spaces with underscores:

function RenameEntityAndAttributes(Entity, Log)  
{  
var EntityOldName, EntityNewName, Attribute, a, AttributeOldName, AttributeNewName;  
EntityOldName = Entity.Name;  
EntityNewName = EntityOldName.replace(/ /g,"_"); //renaming entity  
Entity.Name = EntityNewName;  
if (EntityOldName!=EntityNewName)  
Log.Information(“Entity '”+EntityOldName+"’ was renamed to ‘"+EntityNewName+"’");  
for (a=0; a\<Entity.Attributes.Count; a++)  
{  
Attribute = Entity.Attributes.GetObject(a);  
AttributeOldName = Attribute.Name;  
AttributeNewName = AttributeOldName.replace(/ /g,"_"); //renaming attribute  
Attribute.Name = AttributeNewName;  
if (AttributeOldName!=AttributeNewName)  
Log.Information("- Attribute ‘"+AttributeOldName+"’ was renamed to ‘"+AttributeNewName+"’");  
}  
}

function Main(){  
var App = System.GetInterface(“Application”);  
var Model = App.ActiveModel;  
var WS = App.ActiveWorkSpace;  
var Log = System.CreateObject(“Log”);  
if(Model==null) return;

var i, Obj, origName;  
var Counter = 0;  
Model.Lock();

for(i=0; i\<Model.AllObjects.Count;i++)  
{  
Obj = Model.AllObjects.GetObject(i);  
if (Obj.ObjectType==2502)  
{  
RenameEntityAndAttributes(Obj.ParentBase, Log);  
}  
}

Model.UnLock();

System.ShowMessageDialog(1000,‘ReplaceSpacesFromEntitiesAndAttributesNamesDialog’,‘Renaming complete. Details are displayed in the Log area.’,3,4);  
System.RefreshModel(Model);  
}

Brian

---

<div class="post-metadata">

**Author:** ![Dm.satya](https://avatars.discourse-cdn.com/v4/letter/d/ecd19e/32.png) [@Dm.satya](https://forums.toadworld.com/u/Dm.satya)\
**Post date:** [June 6, 2018, 7:51am UTC](https://forums.toadworld.com/t/naming-conventions/2172/5 "2018-06-06T07:51:51Z")

</div>

I am trying convert logical to physical and in logical i have a attribute name  
Column Load Date  
I did simple conversion and applied Naming standards in which I set up glossary for load date  
Load Date = \_LD  
But when i apply it is simply ignoring spaces and follwing is the result  
ColumnLoadDate  
I am trying to get Column\_LD
