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 / Default Gallery Image ...
Power Apps
Answered

Default Gallery Image IF Function Breaks on IsBlank/Substitute

(0) ShareShare
ReportReport
Posted on by 221

Hello,

 

I am trying to achieve some default gallery images if the user has not uploaded their own custom image. This function achieves the default image part. 

If(
 ThisItem.'Service Type' = "PDF",
 'adobe-pdf-icon-logo-png-transparent',
 If(
 ThisItem.'Service Type' = "SQL",
 '3404108-200',
 If(
 ThisItem.'Service Type' = "Excel",
 '61045dfc9cd69c000418c11a',
 If(
 ThisItem.'Service Type' = "Power Bi Report",
 'Power-BI-Logo-Transparent',
 If(
 ThisItem.'Service Type' = "Crystal Report",
 'sap-crtsyal-350x296',
 If(
 ThisItem.'Service Type' = "Word",
 'word-file-icon-8',
 ""
 )
 )
 )
 )
 )
)

 

However when I add this first isblank/substitute part to accommodate the user custom images being prioritized, the function does not replace the default icons, but does not error out either. Am I missing something? Is there a better way of doing this than nested IF statements?

If(
 !IsBlank(ThisItem.Image),
 Substitute(
 ThisItem.Image,
 """",
 ""
 ),
 If(
 ThisItem.'Service Type' = "PDF",
 'adobe-pdf-icon-logo-png-transparent',
 If(
 ThisItem.'Service Type' = "SQL",
 '3404108-200',
 If(
 ThisItem.'Service Type' = "Excel",
 '61045dfc9cd69c000418c11a',
 If(
 ThisItem.'Service Type' = "Power Bi Report",
 'Power-BI-Logo-Transparent',
 If(
 ThisItem.'Service Type' = "Crystal Report",
 'sap-crtsyal-350x296',
 If(
 ThisItem.'Service Type' = "Word",
 'word-file-icon-8',
 ""
 )
 )
 )
 )
 )
 )
)

 

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,958 Most Valuable Professional on at

    Hi @Ginko ,

    I tend to make a blank image in my Media (it is quite useful at times) and do this

     

    Switch(
     ThisItem.'Service Type',
     "PDF",
     'adobe-pdf-icon-logo-png-transparent',
     "SQL",
     '3404108-200',
     "Excel",
     '61045dfc9cd69c000418c11a',
     "Power Bi Report",
     'Power-BI-Logo-Transparent',
     "Crystal Report",
     'sap-crtsyal-350x296',
     "Word",
     'word-file-icon-8',
     BlankImage
    )

     

     

    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

     

  • Ginko Profile Picture
    221 on at

    This is so much cleaner, I need to learn more about switches. Works great thank you!

     

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 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard