Skip to main content
I have a pageBlockTable and I would like to display an image if certain criteria is met. I have tried every variation I can think of for this formula but the only result I get is showing the text result 'http://www.locatormls.com/staticfiles/misc/{!apt.Star_Image__c}star.png' it doesn't actually show the image. The formula below shows an error - IMAGE can't but used in this formula.

Any suggestions? The full code is below:

{!IF(apt.Star_Image__c > 0,  IMAGE('http://www.locatormls.com/staticfiles/misc/{!apt.Star_Image__c}star.png', "Image"), NULL)}    

<apex:pageBlock >

        <apex:pageBlockTable value="{!HOUDirectory}" id="HOUdir" var="apt" columnClasses="colcenter" headerClass="header" rowClasses="row" columnsWidth="200px,80px,60px,200px,200px,200px,150px">

            <apex:column style="vertical-align:top;text-align:left;font-family:trebuchet ms" headerValue="Complex Name">

                  {!apt.Complex_Name__c}              

            </apex:column>

            <apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Phone">

                {!apt.Phone__c}

            </apex:column>

            <apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Year Built">

                {!apt.Year_Built__c}

            </apex:column>

            <apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Management">

                {!apt.Management_Company__r.Name}

            </apex:column>

            <apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Area">

                {!apt.Submarket__r.Name}

            </apex:column>

            <apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="Commission">

                {!apt.Commission_Type__c}

            </apex:column>

            <apex:column style="vertical-align: top;font-family:trebuchet ms" headerValue="">

               {!IF(apt.Star_Image__c > 0,  IMAGE('http://www.locatormls.com/staticfiles/misc/{!apt.Star_Image__c}star.png', "Image"), NULL)}

            </apex:column>

        </apex:pageBlockTable>
2 answers
0/9000