Upper / Lower Case | Sage Report Designer

SOLVED

Hi all

One of my colleagues has just asked the following.

"Is there any function that converts the first character to the upper case and rests to the lower case? Such as ‘Proper’ in excel? "

Many thanks 

  • +1
    verified answer

    Not that I'm aware of, no.

    Because there's no string split you're a bit limited even in terms of bodging something together from the existing functions. You can do something like this:

    ToUpper(Substring(SLCustomerAccounts.CustomerAccountName, 0, 1))+ ToLower(Substring(SLCustomerAccounts.CustomerAccountName, 1))

    ...but that will only capitalise the very first letter in the entire string, rather than the first letter of each individual word in the string (which is what Excel's PROPER does).

    If the use case is extremely limited then you could fix the issue in the data model itself. For example if we only needed to do this for CustomerAccountName then you could just modify the data model by deploying an extension that contains something like this:

    public partial class SLCustomerAccount
    {
        [DerivedField("GetNiceName")]
        public string NiceName
        {
            get
            {
                return GetNiceName.Compile().Invoke(this);
            }
        }
        
        [StaticExpandable]
        public static Expression<Func<SLCustomerAccount, string>>GetNiceName
        {
            get
            {
               return c => (
                    new System.Globalization.CultureInfo("en-GB", false)
                            .TextInfo.ToTitleCase(c.CustomerAccountName.ToLower()) 
                );                
            }
        }
    }

    Now the string formatting is being done in the data model itself - so you'd use the NiceName property on the reports that needed it.

  • 0 in reply to Chris Burke

    Hi Chris

    Thanks for your very detailed answer. However, we are end-users with no access to any developing tool. 

    The aim is to make our layouts look more professional. We will either use the ToUpper or leave it as it is. 

    Again, many thanks for your clarification. 

  • 0 in reply to JS_

    Ah, I think for some reason I'd assumed you were a Sage Business Partner.

    There's probably a better solution. Which version of Sage 200 are you currently using (as in the version that's shown under Help -> About)?

  • 0 in reply to Chris Burke

    Hi Chris 

    We are currently on version 12.00.0036. 

    Looking forward to hearing from you. 

    Thanks 

  • 0 in reply to JS_

    OK, if you look under my profile you'll find my email address. Ping me an email and I'll get you sorted.