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.
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
Solved! Go to Solution.
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)& "."
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)& "."))
What is the format of the display name for a user with a middle name or initial?
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
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)& "."
Thank you Jeff. Can you advise how to edit the Mech Eng formula that has a condition built in for "pending"?
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)& "."
)
)
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:
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)& "."))
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
User | Count |
---|---|
196 | |
124 | |
87 | |
49 | |
42 |
User | Count |
---|---|
284 | |
163 | |
138 | |
75 | |
72 |