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
yazid akki 15yazid akki 15 

Display any picture or text any 2 or other case

Hi All,

I need to display a picture in VFPage. In my custom field, I have the formula 
image("/resource/STR_TRIANGLE" & case( IconFlag__c, 1,"", 2,"",'none') ,"",20,20)
I want to display the STR_TRIANGLE picture, if FlowerFlag ==1, if FlowerFlag === 2  or other, there is nothing.
It displayed a dark picture sss  when it’s 2 or other .

Any idea Please?
Best Answer chosen by yazid akki 15
pconpcon
I believe you want to use the following formula
 
IMAGE(
    CASE(IconFlag__c,
        1, "/resource/STR_TRIANGLE",
        2, "/resource/STR_TRIANGLE",
        ""
    ),
    "Icon Flag",
    20,
    20
)

This will show the resource (assuming that is the correct path to the resource) if the IconFlag__c field is equal to 1 or 2 and will show nothing if it is not.  You can change that by updating the path in line 5 from an empty string.

If this is not what you are trying to do, please let me know.

All Answers

pconpcon
I believe you want to use the following formula
 
IMAGE(
    CASE(IconFlag__c,
        1, "/resource/STR_TRIANGLE",
        2, "/resource/STR_TRIANGLE",
        ""
    ),
    "Icon Flag",
    20,
    20
)

This will show the resource (assuming that is the correct path to the resource) if the IconFlag__c field is equal to 1 or 2 and will show nothing if it is not.  You can change that by updating the path in line 5 from an empty string.

If this is not what you are trying to do, please let me know.
This was selected as the best answer
yazid akki 15yazid akki 15
Thank you pcon (y)