+ Start a Discussion
SkeeterSkeeter 

Image formula

I was wondering if I could get some assistance with an image formula field.  Any help is greatly appreciated.
Error: Incorrect number of parameters for function 'IMAGE()'. Expected 2, received 1

grade = D and the score is less than 50 (0 stars)
grade = D and the score is greater than 50 (1 star)
grade = C and the score is less than 50 (1 star)
grade = C and the score is greater than 50 (2 stars)
grade = B and the score is less than 50 (2 stars)
grade = B and the score is greater than 50 (3 stars)
grade = A and the score is less than 50 (3 stars)
grade = A and the score is greater than 50 (4 stars)
 
IF(AND(pi__grade__c = 'D',pi__score__c<50),IMAGE("img/samples/stars_000.gif"),

IF(AND(pi__grade__c = 'C',pi__score__c<50),IMAGE("img/samples/stars_100.gif"),
IF(AND(pi__grade__c = 'D',pi__score__c>50),IMAGE("img/samples/stars_100.gif"),

IF(AND(pi__grade__c = 'C',pi__score__c>50),IMAGE("img/samples/stars_200.gif"),
IF(AND(pi__grade__c = 'B',pi__score__c<50),IMAGE("img/samples/stars_200.gif"),

IF(AND(pi__grade__c = 'B',pi__score__c>50),IMAGE("img/samples/stars_300.gif"),
IF(AND(pi__grade__c = 'A',pi__score__c<50),IMAGE("img/samples/stars_300.gif"),


IF(AND(pi__grade__c = 'A',pi__score__c>50),IMAGE("img/samples/stars_400.gif"),"Rating"))))))))

 
Balaji Chowdary GarapatiBalaji Chowdary Garapati
@lilranger:


Try This:
 
IF(AND(pi__grade__c = 'D',pi__score__c<50),IMAGE("img/samples/stars_000.gif","D Grade"),

IF(AND(pi__grade__c = 'C',pi__score__c<50),IMAGE("img/samples/stars_100.gif","C Grade"),
IF(AND(pi__grade__c = 'D',pi__score__c>50),IMAGE("img/samples/stars_100.gif","D Grade"),

IF(AND(pi__grade__c = 'C',pi__score__c>50),IMAGE("img/samples/stars_200.gif","C Grade"),
IF(AND(pi__grade__c = 'B',pi__score__c<50),IMAGE("img/samples/stars_200.gif","B Grade"),

IF(AND(pi__grade__c = 'B',pi__score__c>50),IMAGE("img/samples/stars_300.gif","B Grade"),
IF(AND(pi__grade__c = 'A',pi__score__c<50),IMAGE("img/samples/stars_300.gif","A Grade"),


IF(AND(pi__grade__c = 'A',pi__score__c>50),IMAGE("img/samples/stars_400.gif","A Grade"),"Rating"))))))))

Image Function accepts 4 parameters, Image URL(required),Alternate Text(required),height(optional),width(optional)

So just given an extra parameter,

For additional info:

https://help.salesforce.com/apex/HTViewHelpDoc?id=useful_advanced_formulas_image_links.htm&language=en_US


Hope it helps.,

Thanks,
Balaji
SkeeterSkeeter
Thanks for the help.  I guess I will have to play around it to see if I can get it to work.

I had a contact with grade of A and score of 55, which should have displayed 4 stars, but instead it showed 'Rating'
SkeeterSkeeter
I got to work, but editing the last portion
 
IF(AND(pi__grade__c = 'D',pi__score__c<50),IMAGE("img/samples/stars_000.gif","D Grade"), 

IF(AND(pi__grade__c = 'C',pi__score__c<50),IMAGE("img/samples/stars_100.gif","C Grade"), 
IF(AND(pi__grade__c = 'D',pi__score__c>50),IMAGE("img/samples/stars_100.gif","D Grade"), 

IF(AND(pi__grade__c = 'C',pi__score__c>50),IMAGE("img/samples/stars_200.gif","C Grade"), 
IF(AND(pi__grade__c = 'B',pi__score__c<50),IMAGE("img/samples/stars_200.gif","B Grade"), 

IF(AND(pi__grade__c = 'B',pi__score__c>50),IMAGE("img/samples/stars_300.gif","B Grade"), 
IF(AND(pi__grade__c = 'A',pi__score__c<50),IMAGE("img/samples/stars_300.gif","A Grade"), 


IMAGE("img/samples/stars_400.gif","Rating"))))))))