cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Prodigy
Post Prodigy

Gallery Abbreviated Name Issue

@RandyHayes 

 

Hello,

 

I have an issue that I'm not sure how to approach. Randy, you were kind enough to provide a formula that yields the abbreviated name results you see below. This is super handy when an app maker has lots of columns in a gallery and are trying to eke out more space. In most cases it works perfectly, but unfortunately we have a few employees with middle initials that are throwing it off.  Pacheco's middle initial is A. Her first name starts with an S. Is there a way to account for this variant using conditional logic? The Requestor and Project Mgr formulas are essentially the same. The Mech Engr formula allows for "pending" if no ME has yet been assigned to the project. I've had this come up with an ME who also has a middle initial in his display name.

 

TDCGallerySS.png

Requestor:
With(
{UserName: Split(ThisItem.'Created By'.DisplayName, " ")},
First(UserName).Result & " " & Left(Last(UserName).Result,1)& "."
)

Project Mgr:
With(
{UserName: Split(ThisItem.PMPEPerson.DisplayName, " ")},
First(UserName).Result & " " & Left(Last(UserName).Result,1)& "."
)

Mech Engr:
With({dn:Match(ThisItem.'ME Assigned'.DisplayName, "^.*\s.").FullMatch},
If(IsBlank(dn), "pending", dn & ".")
)

 

Thanks in advance!

Teresa

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Try using the FirstN inside the Last() for first name. It would look something like this: 

 

First(UserName).Result & " " & Left(Last(FirstN(UserName, 2)).Result,1)& "."

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

I think the issue with formula I posted was that I used "UserName" and not "username" when referencing the with variable.

 

Try this:

 

With({username: Split(ThisItem.'ME Assigned'.DisplayName, " ")}, If(IsEmpty(username), "Pending", First(username).Result & " " & Left(Last(FirstN(username, 2)).Result,1)& "."))

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

8 REPLIES 8
Super User
Super User

What is the format of the display name for a user with a middle name or initial? 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

@Jeff_Thorpe 

 

Hi Jeff,

 

I looked at a few employee profiles. Most of the time if someone has a middle initial it appears as:

Last Name, First Name Middle Initial

 

Some are odd like:

Last Name, First Name MIDDLE NAME IN ALL CAPS

 

The majority of display names are simply:

Last Name, First Name

 

Thanks,

Teresa

 

Super User
Super User

Try using the FirstN inside the Last() for first name. It would look something like this: 

 

First(UserName).Result & " " & Left(Last(FirstN(UserName, 2)).Result,1)& "."

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

@Jeff_Thorpe 

 

Thank you Jeff. Can you advise how to edit the Mech Eng formula that has a condition built in for "pending"?

Super User
Super User

I must admit I don't understand why Mech Engr is using Match. I would have thought something like this would have worked:

 

With({username: Split(ThisItem.'ME Assigned'.DisplayName, " ")},
  If(IsEmpty(username), 
    "pending", 
    First(UserName).Result & " " & Left(Last(FirstN(UserName, 2)).Result,1)& "."
  )
)

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

@Jeff_Thorpe 

@RandyHayes 

 

Hello Jeff,

 

The first formula you provided worked great for the Requestor and Project Mgr fields. Thanks!

Unfortunately, the formula for the Mech Eng field is throwing some errors. I tried replacing IsEmpty with IsBlank just in case that would work. I also tried manually entering the formula in case there was an issue with the copy and paste, but that didn't work either. Are we missing a character somewhere or is a return to the Match version necessary? The Match version of the formula was working I'm just not sure how to edit it to make sure it bypasses middle initials/middle names as I haven't learned expressions yet. Since I believe Randy wrote the original formula, I'm copying him here in case he has time to chime in.

 

For the sake of convenience, here is the ME Text formula again:

 

With({dn:Match(ThisItem.'ME Assigned'.DisplayName, "^.*\s.").FullMatch},
If(IsBlank(dn), "pending", dn & ".")
)

 

Text property error screenshot:

 

TextFormulaError.png

 

Thank you both for sharing your expertise,

Teresa

 

 

I think the issue with formula I posted was that I used "UserName" and not "username" when referencing the with variable.

 

Try this:

 

With({username: Split(ThisItem.'ME Assigned'.DisplayName, " ")}, If(IsEmpty(username), "Pending", First(username).Result & " " & Left(Last(FirstN(username, 2)).Result,1)& "."))

 



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

View solution in original post

@Jeff_Thorpe 

@RandyHayes 

 

Hi Jeff,

 

Thanks for your help in figuring this out. It might have been Matthew Devaney that helped me out with the original formulas. I tried looking through my old posts, but I've asked for help so many times it was a lot to plow through. I so appreciate folks like you and Randy for helping out us beginners. I was able to extrapolate what you gave me here to adjust my filter formulas which also abbreviate names. It gives me hope!

 

Have a great weekend!

Teresa

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Top Solution Authors
Top Kudoed Authors
Users online (47,463)