Hi there I can easily get my full name in a label by going User().FullName - but how would I get my initals (so my name is Jason hough - and initials will be JH) ?
Solved! Go to Solution.
If the name only has two parts (first / last), then you can use the formula below:
Left(User().FullName, 1) & Mid( User().FullName, Find(" ", User().FullName) + 1, 1)
The first part takes the first character (initial of the first name); the second part first finds the first space within the full name, then takes the first character after that space.
If you have name with multiple parts (e.g., Barack Hussein Obama => BMO; George W Bush => GWB), then there's no simple way to get the initials - we need a function to split a string into a table/collection, and this doesn't exist. If this is your scenario, please consider upvoting this feature request in the PowerApps Ideas board.
If the name only has two parts (first / last), then you can use the formula below:
Left(User().FullName, 1) & Mid( User().FullName, Find(" ", User().FullName) + 1, 1)
The first part takes the first character (initial of the first name); the second part first finds the first space within the full name, then takes the first character after that space.
If you have name with multiple parts (e.g., Barack Hussein Obama => BMO; George W Bush => GWB), then there's no simple way to get the initials - we need a function to split a string into a table/collection, and this doesn't exist. If this is your scenario, please consider upvoting this feature request in the PowerApps Ideas board.
The latest PowerApps release now has a Split function, which can be used to solve this problem in a more generic way:
Concat(Split(User().FullName, " "), Left(Result, 1))
Great news about the new Split function. In addition to what @CarlosFigueira said, I would use this approach wherever you use the User() function, otherwise app perfomance may suffer.
That is seriously cool. Works on names with more than two initials. Thanks for that.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
187 | |
70 | |
50 | |
36 | |
25 |
User | Count |
---|---|
239 | |
111 | |
89 | |
88 | |
66 |