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!
Glad it help!
Please remember to give a 👍 and accept my solution as it will help others in the future.
Hi CNT,
Thank you, that worked!
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"
)
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional