cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MarkFay1
Frequent Visitor

Need help with visible property with multiple conditions

I have been scouring the interwebs for an example like mine but have not come across one. 

At face value the need is simple I have a picture (yellow stop light) in a gallery that I want to be conditional. However my gallery is also filtered by the visible property due to one of the filters being a multi choice field in sharepoint. I believe this creates my problem. The work around I am using to filter the gallery is I created a group for all the items in the gallery and in the visible property of the group I have 

ddproduct.Selected.Value in ThisItem.Product.Value || ddproduct.Selected.Value=""

where ddproduct = a drop down created to filter the gallery. Its Items are ["","RI", "CI", "AV", "PNM", "PB","ROCC"]

ThisItem.Product is the choice field in sharepoint.

 

Now this all works fine if I exclude the empty value in my dropdown item ("" in the drop down and exclude the || ddproduct.Selected.Value=""), but I need the gallery to display all products and then let the user filter accordingly. So then to compound the need I have two more requirements, I need to display a picture based on a sharepoint list entry (ThisItem.Flag) and some items in the sharepoint list I want hidden so I have a field (ThisItem.HideInGallery) that I am looking at. So my attempt was this;

ThisItem.Flag="Caution"&& ddproduct.Selected.Value in ThisItem.Product.Value || ddproduct.Selected.Value="" && !ThisItem.HideInGallery

So if I select an item in the drop down it works as shown here

MarkFay1_0-1660074762658.png

But as soon as I select the empty value in the drop down, everything gets a yellow light

MarkFay1_1-1660074987248.png

 

Is there a limit to the number of conditions I can use in the visible property, or am I not writing the command correctly (likely).

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Tony_Bowes_BP
Helper I
Helper I

To answer the last question, no, there isn't a limit to the visible property (or at least we haven't hit one with dozens of lines of conditional logic). There is a practical limit in that your logic starts to become unreadable without braces and eventually using AND() / OR () functions. Eg: 

If(
  Or(

    And(

      Scenario1criteria,

      Scenario1criteria2

    ),

    And(

      Scenarion2criteria,

      Scenario2criteria2

    )

  ),
  true,
  false
)

 

For the visibility, it looks like there are 2 separate issues, the visibility of the image WITHIN the item being displayed (based off a flag), and the visibility of the item itself (based off filtering criteria). 

 

If this is a correct interpretation of the problem, then try setting the visibility of the image to: ThisItem.Flag="Caution"

 

Then set the visibility of the group to:

If(
  And(

    !ThisItem.HideInGallery,

    Or(

      ddproduct.Selected.Value in ThisItem.Product.Value,

      ddproduct.Selected.Value=""

    )

  ),

  true,
  false
)

 

Please excuse any typos.

View solution in original post

4 REPLIES 4
cwebb365
Super User
Super User

Don't put it on the group visability, put it on the stoplight image. 
ddproduct.Selected.Value in ThisItem.Product.Value && ddproduct.Selected.Value <>"" 

 

That should work if I understand correctly. 

 

Yea I was just trying that. I added the ThisItem.Flag="Caution" only to the spotlight and that did not fix it. I just tried 

ddproduct.Selected.Value in ThisItem.Product.Value && ddproduct.Selected.Value <>""  and that yielded no results

MarkFay1_0-1660077503819.png

 

Tony_Bowes_BP
Helper I
Helper I

To answer the last question, no, there isn't a limit to the visible property (or at least we haven't hit one with dozens of lines of conditional logic). There is a practical limit in that your logic starts to become unreadable without braces and eventually using AND() / OR () functions. Eg: 

If(
  Or(

    And(

      Scenario1criteria,

      Scenario1criteria2

    ),

    And(

      Scenarion2criteria,

      Scenario2criteria2

    )

  ),
  true,
  false
)

 

For the visibility, it looks like there are 2 separate issues, the visibility of the image WITHIN the item being displayed (based off a flag), and the visibility of the item itself (based off filtering criteria). 

 

If this is a correct interpretation of the problem, then try setting the visibility of the image to: ThisItem.Flag="Caution"

 

Then set the visibility of the group to:

If(
  And(

    !ThisItem.HideInGallery,

    Or(

      ddproduct.Selected.Value in ThisItem.Product.Value,

      ddproduct.Selected.Value=""

    )

  ),

  true,
  false
)

 

Please excuse any typos.

YES!!! that worked.. Thank you!

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,146)