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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Images not displaying ...
Power Apps
Answered

Images not displaying in image control

(0) ShareShare
ReportReport
Posted on by 5,836 Moderator
I have a gallery with an image control.   I am displaying any one of 4 images depending on specific values in the gallery items.  At the very least it should be displaying the dot.  The properties ship, called and hit are all true/false.
 
Switch(ThisItem.Ship,

    true, If(ThisItem.Called && ThisItem.Hit, "Fire",
             ThisItem.Called && !ThisItem.Hit, "Radar",
             "BlueAnchor",
             
    false, "Dot")
    )
The images are uploaded to Power Apps. There are no errors in the switch statement, but no images are being displayed either.  I have tried using the Image name with and without the .png at the end.  This same switch statement works fine if I use an icon rather than an image.
 
 
        
 
 
 
 
 
 
 
 
  • Verified answer
    WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at
    Firstly, you do not need quotes "" around the image names
    Switch(
       ThisItem.Ship,
       true, 
       If(
          ThisItem.Called && ThisItem.Hit, 
          Fire,
          ThisItem.Called && !ThisItem.Hit, 
          Radar,
          BlueAnchor
       ),        
       false, 
       Dot
    )
    There was also a bracket in the wrong place
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee
  • Verified answer
    JR-BejeweledOne Profile Picture
    5,836 Moderator on at
    @
    Switch(ThisItem.Ship,
    
        true, If(ThisItem.Called && ThisItem.Hit, Fire,
                 ThisItem.Called && !ThisItem.Hit, Radar,
                 Anchor),
                 
        false, Dot
        )
        
    @WarrenBelz  I was initially getting an error that it expected an image value.  The quotes removed that error, but it appears that the other error was the whole problem.  Here is the modified working formula.  Note that I removed the 'true' value after ThisItem.Ship.   ThisItem.Ship is already a true/false value and adding true gave another error.
     
     
     
     
  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at
    To be honest, I would get rid of the Switch
    If(
       ThisItem.Ship,
       If(
          ThisItem.Called && ThisItem.Hit, 
          Fire,
          ThisItem.Called && !ThisItem.Hit, 
          Radar,
          BlueAnchor
       ),        
       Dot
    )
     
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at
    @@WarrenBelz do you mind if I ask why?  I would like to understand why you would prefer the If statement.
  • WarrenBelz Profile Picture
    156,940 Most Valuable Professional on at
    Just because it is less complex in your case - I generally only bother with Switch when there are more than two possible results (which saves specifying the value multiple times) otherwise it is simply If/then/else.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard