web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Compare FullName of co...
Power Apps
Answered

Compare FullName of contact in gallery to variables whose values are an account's primary and secondary contacts

(0) ShareShare
ReportReport
Posted on by 28

Hi,

 

I'm building a Power App which passes the GUID of an account into the app as a URL parameter.  

 

One screen in the app has combo boxes which allows the running user to select the primary and secondary contacts for the account.  The changes are applied to the datasource via a button.  The OnSelect property of the button also sets two global variables as follows:

 

Set(PrimaryContact, 'ComboBox primary contact'.Selected.'Full Name')
;
Set(SecondaryContact, 'ComboBox secondary contact'.Selected.'Full Name')

 

The next screen in the app has two galleries.  One is for accounts and is filtered to show only the account whose GUID is in the URL.  The second gallery is for contacts related to the account.  The contacts gallery is filtered by the Items property 'Gallery Accounts'.SelectedContacts.

 

I created two label fields to display the primary and secondary contact variables to confirm that they passed from the previous screen to the gallery screen.  They do pass successfully to the gallery screen.

 

My contacts gallery has label field whose name is 'Gallery label full name" and whose Text property is ThisItem.'Full Name'. I have created another label field in the gallery called 'Role'.  I want to populate the field 'Role' with the result of a function which compares 'Gallery label full name' to the global variable PrimaryContact and if they don't match, to then compare 'Gallery label full name' to the global variable SecondaryContact and if there is still no match, to display "no role defined".  

 

Here is my problem.  I started with a simple IF function with a couple configurations just to see if I was on the right track but they don't work:

If(Contacts,ThisItem.'Full Name' = Text(PrimaryContact),"Primary Contact", "false")

If(Contacts,ThisItem.'Full Name' = Value(PrimaryContact),"Primary Contact", "false")

If(Contacts,ThisItem.'Full Name' = PrimaryContact,"Primary Contact", "false")

 

I keep getting the error "Invalid argument type (Table). Expecting a Boolean value instead.

 

Help, please!

 

Categories:
I have the same question (0)
  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @SRW04027 

    Please try the following,

    Set the Text property of the Label to,

    Switch(ThisItem.'Full Name',
    	PrimaryContact, "Primary Contact",
    	SecondaryContact, "Secondary Contact",
    	"No role defined"
    )
  • SR04027 Profile Picture
    28 on at

    Hi CNT,

     

    Thank you, that worked!

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @SRW04027 

    Glad it help!

     

    Please remember to give a 👍 and accept my solution as it will help others in the future.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard