function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matthew AllenMatthew Allen 

formula to visualforce

Hi,
I have a formula that shows images based on whether certain text is found in a text field. The problem I have is that there are about 30 different images needed and doing it as a formula field exceeds the formula size limit.

Can someone help me replicate this as a visualforce page?

The formula below just shows 3 brands, but if I can get this to work, I can then rework the code to include the others

IF(
CONTAINS( Brand_Concat_Group__c ,"Audi"),
IMAGE("https://c.eu10.visual.force.com/resource/1521024589000/AUDI", "Audi", 80, 100),
null
) & " " &
IF(
CONTAINS(Brand_Concat_Group__c,"BMW"),
IMAGE("https://c.eu10.visual.force.com/resource/1521024614000/BMW", "BMW",80,100),
null
) & " " &
IF(
CONTAINS(Brand_Concat_Group__c,"Fiat"),
IMAGE("https://c.eu10.visual.force.com/resource/1521024641000/FIAT", "Fiat",80,80),
null
)

Thank you

Matt
Avishek Nanda 14Avishek Nanda 14
Hey  Matthew,

Instead of using formula field you could add the images to static resources and have them populated on VF page based on your criteria. 
Define Your criteria in your Apex controller and have the image populated on VF Page.

Remember, you can add VF page to standard details page only. Which mean the page will show after the record is saved. 

Let me know if this helps. Mark this as best answer. 
Matthew AllenMatthew Allen
Yes, thats what I have asked help for. Can you help tell me how to do it?

I have done this -
 
<apex:page standardController="Account" sidebar="false" showheader="false" readOnly="true">
  <div style="text-align:center;font-size: 25px;">

 </div>

<apex:form >
<table width="100%"> 
  <tr>
    <td style="width:10%"><apex:image id="Abarth" value="{!IF(CONTAINS(Account.Brand_Concat_Centre__c ,"Abarth"), $Resource.LogoAbarth, Null)}" width="100" height="100"/></td>
    <td style="width:10%"><apex:image id="Audi" value="{!IF(CONTAINS(Account.Brand_Concat_Centre__c ,"Audi"), $Resource.LogoAudi, Null)}" width="100" height="100"/></td>
    <td style="width:10%"><apex:image id="BMW" value="{!IF(CONTAINS(Account.Brand_Concat_Centre__c ,"BMW"), $Resource.LogoBMW, Null)}" width="100" height="100"/></td>
    
  </tr>
  

</table>






</apex:form>
</apex:page>
but it shows a blank box if the Brand isn't contained in the Brand_Concat_Centre__c field?

Any ideas how I can convert my formula in the original post into a VF Page?