0

I follow this tutorial step by step..

This is my formula:

="<DIV><img src='" 
&IF(Available=1,"/SiteAssets/IMG/Completed.png",
 IF(Available=0,"/SiteAssets/IMG/notCompleted.png"))& "'>
</DIV>"

Result is

  • where returned value of calculated column is Single line text:

enter image description here

  • where returned value of calculated column is Number:

enter image description here

Where i'm wrong? Thank you previously!!!

5
  • 1
    Is your Indicator column is calculated column with number return type? Dec 7, 2016 at 11:59
  • View updated answer...
    – Goshky
    Dec 7, 2016 at 12:04
  • For Number, it will work. Your image paths are wrong. Try "../SiteAssets/IMG/Completed.png" as image path. Dec 7, 2016 at 12:05
  • ="<DIV><img src='"&IF(Available=1,"../SiteAssets/IMG/Completed.png",IF(Available=0,"../SiteAssets/IMG/notCompleted.png"))&"'></DIV>" --> with this result is the same...
    – Goshky
    Dec 7, 2016 at 12:09
  • Just try this. Try to check your image url from browser by inspecting the element. Its just url related issue. Dec 7, 2016 at 12:12

1 Answer 1

1

Your Formula:

="<DIV><img src='" 
 &IF(Available=1,"/SiteAssets/IMG/Completed.png",
 IF(Available=0,"/SiteAssets/IMG/notCompleted.png"))& "'>
 </DIV>"

Reformatted with linebreaks and spacing:

="<DIV><img src='" 
 &IF( Available=1
      ,"/SiteAssets/IMG/Completed.png"
      ,IF( Available=0
           ,"/SiteAssets/IMG/notCompleted.png"
         )
    )
 & "'></DIV>"

if Available is a boolean you can shorten that to:

="<DIV><img src='" 
 &IF( Available
      ,"/SiteAssets/IMG/Completed.png"
      ,"/SiteAssets/IMG/notCompleted.png"
    )
 & "'></DIV>"

and to:

="<img src='/SiteAssets/IMG/" 
 &IF( Available
      ,""
      ,"not"
    )
 & "Completed.png'>"

Now you can fix the path issue easily

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.