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 / Images not displaying ...
Power Apps
Unanswered

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.
 
 
        
 
 
 
 
 
 
 
 
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    152,855 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
    152,855 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
    152,855 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

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 757 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 322 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 209 Super User 2025 Season 2

Last 30 days Overall leaderboard