Skip to main content

Notifications

Community site session details

Community site session details

Session Id : wVmI9hzYtWLEIX2sn3tEsf
Power Apps - Building Power Apps
Answered

Check if Gallery Item was selected

Like (0) ShareShare
ReportReport
Posted on 30 Aug 2023 17:43:35 by 51

What is the conditional syntax to check if a gallery item has been selected?

I want to display the office365 userprofile.displayname based on a field (Parole officer email) in the selected gallery item.

 

If a Gallery item is not selected, the call to office365 generates an error because I am passing it an empty string instead of an email address:

Without a selected item

Office365Users.UserProfileV2(ThisItem.ParoleOfficeEmail).displayName) becomes

Office365Users.UserProfileV2("empty string").displayName)

  • FerrDiBarnes Profile Picture
    51 on 30 Aug 2023 at 17:59:59
    Re: Check if Gallery Item was selected

    Right you are,  some items have no parole officer email,  which isBlank fixes .

     

  • Verified answer
    LaurensM Profile Picture
    12,510 Super User 2025 Season 1 on 30 Aug 2023 at 17:49:50
    Re: Check if Gallery Item was selected

    Hi @FerrDiBarnes,

     

    In order to check whether a gallery item is selected you can use ThisItem.IsSelected , which will return true or false. That being said, ThisItem.ParoleOfficeEmail should not be dependent on the gallery selection since it is evaluated for each row individually.

     

    The function may display errors for rows that do not have a ParoleOfficeEmail, the following may help instead:

    If( 
     !IsBlank(ThisItem.ParoleOfficeEmail),
     Office365Users.UserProfileV2(ThisItem.ParoleOfficeEmail).displayName)
    )

     

    If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.

    Thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,776 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,093 Most Valuable Professional

Leaderboard