cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Lauren_
Helper V
Helper V

Label, multiple if statement for text

Hey guys, I'm having real problems with understanding if/switch/multiple if statements 😂

 

I'm trying to set up a label text so that depending on whether certain quoted words are in a field, it shows the relevant text. My If statement below has been taken but only shows the first one.

 

If("Analytical Chemistry" in Gallery2.Selected.LabsChosen,"Analytical Chemistry: "&Char(10)&Gallery2.Selected.'Ana-Fulfilment'&Char(10)&Char(10),
("Biochemistry" in Gallery2.Selected.LabsChosen),"Biochemistry: "&Char(10)&Gallery2.Selected.'Biochem-Fulfilment'&Char(10)&Char(10),
("Cell Biology" in Gallery2.Selected.LabsChosen),"Cell Biology: "&Char(10)&Gallery2.Selected.'CB-Fulfilment'&Char(10)&Char(10),
("Microbiology" in Gallery2.Selected.LabsChosen),"Microbiology: "&Char(10)&Gallery2.Selected.'Microb-Fulfilment'&Char(10)&Char(10),
("Molecular Biology" in Gallery2.Selected.LabsChosen),"Molecular Biology: "&Char(10)&Gallery2.Selected.'Molecb-Fulfilment'&Char(10)&Char(10),
("Preparative Chemistry" in Gallery2.Selected.LabsChosen),"Preparative Chemistry: "&Char(10)&Gallery2.Selected.'PrepChem-Fulfilment',
IsBlank(Gallery2.Selected.LabsChosen),"")

12 REPLIES 12

@iwonder  Something like this?

Hey Warren, possibly some wires crossed, been trying to work the function code you gave then realised selecteditems 🙂 It's a single item selection from the gallery, I'm trying to get it to look at the specific strings of words within a single field and if they're there, to display certain text within the label, and if not , not to display the text. There are 6 strings in total I am trying to get it to acknowledge.

HI @Lauren_ ,

Back to basics again - if it is a single value selected, why do you need the two hard returns? Also your initial posted code seems fairly close to the solution except you need

If(
   Gallery2.Selected.xxxx = "Analytical Chemistry",
   LookUp(
       . . . . . .

and Or() || between the arguments instead of And() &&

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (2,045)