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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Conditionally show ima...
Power Apps
Unanswered

Conditionally show image in Gallery

(0) ShareShare
ReportReport
Posted on by 1,599 Super User 2024 Season 1

Hello,

 

In my PowerApp I have a gallery of items linking to a SharePoint form on another screen.


What I'm trying to do is conditionally display images against each item depending on the value they are linked to in the form.
For reference, the images in my form are conditionally displayed in the based on true/false values of a toggle control.

 

The below shows the Toxic image being displayed when the true/false toggle for this is selected in the SharePoint form.

sudosaurus_2-1643281146848.png

 

I am finding if I add an image control to my gallery and set the formula of the Image function to the below, this seems to display the "Oxidising" image to all rows, even if they're not set to "True" in the SharePoint item.
sudosaurus_0-1643280973240.png

sudosaurus_1-1643281064876.png

 

Any thoughts?

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,030 Most Valuable Professional on at

    Hi @sudosaurus ,

    You did not post the field name (and the image name needs to be different to the field name), but if this is the image beside the Oxidising field

    If(
     ThisItem.OxidisingField,
     Oxidising
    )

     

    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.

    Visit my blog Practical Power Apps

  • Gerard Simpson Profile Picture
    2,987 Moderator on at

    Hi @sudosaurus 

     

    When inside a Gallery, the expression must be written in the context of the item for each row i.e. ThisItem.

     

    Is it just this one image you are trying to show and hide on each row? - if so you can just leave the image property as Oxidising and add this to the 'Visible' property of the image ThisItem.Oxidising (assuming the field is called 'Oxidising')

     

    Hope this helps

     

     

     

     

    So you could try If(ThisItem.Oxidising, Oxidising, blank) - I take it 'blank' is a blank image in your app?

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    Thanks @WarrenBelz 

    Got it working now. 

    Can you think of any way I can get the items to display on the left of the column if only one or two of them are showing rather than this sporadic view?

    sudosaurus_0-1643289494905.png

     

  • WarrenBelz Profile Picture
    153,030 Most Valuable Professional on at

    Hi @sudosaurus ,

    Can you please elaborate on that?

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @WarrenBelz 

     

    These Hazard Classifcation symbols on the right are displayed based on a toggle in a list form on another screen.

     

    Where I use this formula to display the images and this works correcty:

    What I want to do is for the items for example (fairy liquid) I want the icon that is showing to be left-justified and sitting in line with the icons on the other rows, just so that they dont appear sporadically in the gallery.

    sudosaurus_0-1643317541824.png


    I've tried adding the images into a container but still cant seem to figure this out.

    sudosaurus_1-1643317670834.png

    Does this help?

  • WarrenBelz Profile Picture
    153,030 Most Valuable Professional on at

    Hi @sudosaurus ,

    The easiest way is to make each icon's X position the X of the one to the left plus the Width of the one to the left, then have a logic on each that if they are not Visible, have a width of 0 (zero)

     

    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.

    Visit my blog Practical Power Apps

  • sudosaurus Profile Picture
    1,599 Super User 2024 Season 1 on at

    @WarrenBelz 

     

    As they're in a container, I guess by doing so, if the one to the left is visible (if the item is later edited) then it will just shift the one on top of it along?

    Would this be the right solution? If(Oxidising(ThisItem.Oxidising)="No",true,false)

  • WarrenBelz Profile Picture
    153,030 Most Valuable Professional on at

    Hi @sudosaurus ,

    I do not use containers, but as long as you follow the logic and it is either visible or not, then the variable X will work.

     

    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.

    Visit my blog Practical Power Apps

  • alixyz Profile Picture
    2 on at

    hi @sudosaurus , I am attempting to create an app which similarly displays hazard symbols conditionally based on true/false columns for each hazard. I am wondering if you perhaps have come across a better solution than the one reached above. Simply, I want a gallery to display images (of the same name as the columns) when true and work out padding based on that. Any help would be super appreciated!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard