IBusinessObject.GetFriendlyName(System.Enum field)

Sep 22, 2010 at 6:49 PM

Hi,

Can you tell me how this functionality gets populated.  I would like to use it for report labels.  At the moment I am implementing my own functionality to get a 'friendly' name for my fields then came accross this but can't see how to use it.

Thanks,

Rob

Coordinator
Oct 1, 2010 at 3:31 AM

This used to be an option that was deprecated. We have looked the code and it seems that we could bring it back if there is it is needed. Please tell us your need for this functionality.

Oct 1, 2010 at 12:43 PM

It,s no big deal really but it would have just kept things tidier.  My need for the functionality was that, throughout my database system there is a need to interpret actual field names to a user firlendly version, for example 'Contactsurname' to 'Contact Surname'.  These 'User friendly' versions of field names can then be used throughout a system dynamically for screen labels, report labels or when fields are listed in listbox for selection purposes.  At the moment I am using a Dictionary interface in all my business objects partial classes (eg Customers) to achieve this :

         #region IGetOutputLabels Members

        Dictionary<string, string> IGetOutputLabels.GetPrintLabels()
        {
            if (_printLabels == null) {
                _printLabels = new Dictionary<string, string>();
            }

            if (_printLabels.Count == 0) {
                _printLabels.Add("Customercode", "Account No.");
                _printLabels.Add("Contacttitle", "Contact Title");
                ............................................................................................................... 50 fields 

 I was looking for a Dictionary or machanism on the generated class that achieved the same thing.  But like I say, It's no big deal I am able to do it manually with no trouble, I was just curious when I came accross the GetFriendlyName enum by accident and thought I'd ovelooked it when implementing my own mechanism.

Thanks,

Rob

 

Coordinator
Nov 26, 2010 at 8:01 PM

The FriendlyName property has been resurrected and will be in the next version. Each BusinessObject has a GetFriendlyName static method to retrieve the defined names. Also an instance of a business object can be cast to IBusinessObject to call the same instance function. If no name is specified in the model then the name property is used. In other words the returned FriendlyName value will never be empty. It just defaults to the Name property.

Dec 22, 2010 at 10:39 PM

Thank you for your doing this for me it is very much appreciated.