Author Topic: mRep.GetFormattedName - undocumented feature?  (Read 510 times)

DarrenDickens

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
mRep.GetFormattedName - undocumented feature?
« on: June 28, 2018, 12:24:23 am »
Is this another undocumented feature?

I have a script that, given an object (element, parameter, method, tagged value etc), it prints a "fully qualified name", i.e. the path to the object. For example, given an operation parameter it would show "<root package>::<class (great-grand-parent) package>::<class (grand-parent) package>::<class (parent) package>::<class name>::<operation name>::<parameter name>"

This necessitated a recursive lookup of .Name and .Parent objects (noting some item types have alternatives to .Name and .Parent) and takes a (relatively) long time to calculate.

Whilst in the Excel VBA editor I noticed the property...
Code: [Select]
Function GetFormattedName(GUID, FlagInclude As Long, Separator, FlagFormat As Long) As String
    Member of EA.Repository
    Returns a qualified name of the specified element with formatting applied

I could not find this in the Help nor online anywhere via a Google search. It prints a (slightly different) fully qualified name but much quicker than I can generate with my recursive routine. I would like to use it but don't fully understand its quirks (bound to be some).

From my limited testing (more ongoing) I have found the following (my best guess)

Code: [Select]
GUID - string
    e.g. "{C2E97806-3E66-4b75-B42A-ABF565D8A28D}" (without quotes)

Code: [Select]
FlagInclude - long
    Const nFlagIncludeOperationName_c As Long = 1
    Const nFlagIncludeObjectName_c    As Long = 2
    Const nFlagIncludeParentsName_c   As Long = 8
    Const nFlagIncludeModelName_c     As Long = 16

Code: [Select]
Separator - string
    e.g. "::" (without quotes)

Code: [Select]
FlagFormat - long
    Const nFlagFormatNormal_c            As Long = 0
    Const nFlagFormatSpaceToUnderscore_c As Long = 1
    Const nFlagFormatLowerCase_c         As Long = 2

I have not managed to work out any other bit flag meanings as of yet.

EDIT: Forgot to mention that I am using version 12.0.1214 (don't laugh - we are forced to use a specific version)
« Last Edit: June 28, 2018, 12:59:42 am by DarrenDickens »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 9542
  • Karma: +275/-27
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: mRep.GetFormattedName - undocumented feature?
« Reply #1 on: June 28, 2018, 01:02:52 am »
Not an answer, but related.
Since v13 or v14 there's a new property on EA.Element called FQName (Fully Qualified Name)

I never used or heard about GetFormattedName before, but it is indeed not documented.

Geert