Naming Conventions

I’ve been using a forward slash “/” character in relationship captions. I would like to replace this in the relationship name with a dash “-”. I’ve tried using /=- in the Naming Conventions/Glossary, but it highlights red, and doesn’t work. Guidance, please?

Mike

Hi Mike,

The Glossary function serves primarily to replace various language-specific characters with standard English ones. A Glossary replacement is invalid (red) if:

  • The left or the right side contains more than one character
  • The left side is equal to the right side
  • The left side character is an ASCII character (has ASCII value <= 128, except for space character)
    If you wanted to change Names instead of Captions, you could check Relationships in Naming Convention Rules, enter the dash character as Replacer and select Valid Chars according to the picture below:

But in case of Captions, you will probably need to use a Macro instead. I have created one that replaces all forward slashes in all relationship captions in the model with dashes. You only need to copy the code from the attached text file, paste it to Expert Mode Menu | Scripting Window and run it. Expert Mode can be enabled in Settings Menu | Options | General.

NCon2.png

See Message Explorer, it should display which relationship captions have been renamed.

Regards,

Lukas
ReplacementMacro.txt (676 Bytes)

I did want to change Names, so I could have an easily readable relationship name (Caption) on the display diagram, and an implementable (MySQL 5.6) Name for the constraint. After reviewing the acceptable character set for unquoted object names in MySQL, though, I changed the replacement character from the unacceptable “-” to “$”. It all works correctly now, so the caption “part of/made up of” becomes the constraint name “PART_OF$MADE_UP_OF”.