Hi Experts,
Need a little help please. I have a bunch of text input boxes that have the default property set as user email addresses. I'm trying to show a heading on a screen depending on which user is accessing it. There are 2 options (different email addresses) for each department. So essentially it should be if the user is user1@domain.com or user2@domain.com then show the heading as Test1 but if the user is user3@domain.com or user4@domain.com then it should show the heading as Test2.
What I thought the code would be is as per the below but only one of the input boxes seems to be registering and i'm going mad trying to work this out!
If (Lower(User().Email) = Lower(CommercialAndTechSales1.Text) || Lower(CommercialAndTechSales2.Text), "Technical Sales",
If (Lower(User().Email) = Lower(Commercial1.Text) || Lower(Commercial2.Text), "Commercial",
If (Lower(User().Email) = Lower(Sales1.Text) || Lower(Sales2.Text), "Sales",
If (Lower(User().Email) = Lower('R&D1'.Text) || Lower('R&D2'.Text), "R&D",
If (Lower(User().Email) = Lower(QHSE1.Text) || Lower(QHSE2.Text), "Health & Safety / Environmental",
If (Lower(User().Email) = Lower(Production1.Text) || Lower(TestInput.Text), "Production",
If (Lower(User().Email) = Lower(Compliance1.Text) || Lower(Compliance2.Text), "Compliance",
If (Lower(User().Email) = Lower(IT1.Text) || Lower(IT2.Text), "IT"
))))))))
Thanks in advance!
Dave
Thank you for the kind words!
Glad I was able to help. 😊
Hi @LaurensM ,
Thank you so much, this worked perfectly. Also thank you for the detailed explanation that will certainly help me going forwards. Thanks again!
Hi @Dave-ITMan,
You have to repeat the full condition twice when using the OR operator '1 = 1 || 1 = 2'.
We can also make some slight adjustments by removing the nested If statements, temporary saving the User().Email function via the With function and replacing the Lower() functions with the In operator. 'In' does not check for exact equals but whether the value is present in the other value - now in cases that the compared values will always be unique (e.g. email) you can use this to avoid the need for Lower() functions.
With(
{wEmail: User().Email},
If(
wEmail in CommercialAndTechSales1.Text || wEmail in CommercialAndTechSales2.Text,
"Technical Sales",
wEmail in Commercial1.Text || wEmail in Commercial2.Text,
"Commercial",
wEmail in Sales1.Text || wEmail in Sales2.Text,
"Sales",
wEmail in 'R&D1'.Text || wEmail in 'R&D2'.Text,
"R&D",
wEmail in QHSE1.Text || wEmail in QHSE2.Text,
"Health & Safety / Environmental",
wEmail in Production1.Text || wEmail in TestInput.Text,
"Production",
wEmail in Compliance1.Text || wEmail in Compliance2.Text,
"Compliance",
wEmail in IT1.Text || wEmail in IT2.Text,
"IT"
)
)
This setup expects unique values and the TextInput only containing 1 email.
If this solves your question, would you be so kind as to accept it as a solution & give it a thumbs up.
Thanks!
Hi,
Try this
If( Lower(User().Email) = Lower("user1@domain.com") || Lower(User().Email) = Lower("user2@domain.com"), "Test1", Lower(User().Email) = Lower("user3@domain.com") || Lower(User().Email) = Lower("user4@domain.com"), "Test2", "Default Heading" )
Thanks!
If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.
WarrenBelz
146,658
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional