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?
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.
“… 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();
System.ShowMessageDialog(1000,‘ReplaceSpacesFromEntitiesAndAttributesNamesDialog’,‘Renaming complete. Details are displayed in the Log area.’,3,4);
System.RefreshModel(Model);
}
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