How can I return an icon in a calculated field, so it will show in a TableView form, to indicate a status or something for each row?
I’m trying to figure this, but don’t have any clue.
Hello, thanks for reply, but still doesn’t work for me.
I have this calculation, which I set it first to type TEXT, the I tried with MEDIA. But in both cases the image is not displayed in the TableView field.
function status_icon() {
if (status == 1) {
return "media:///circle_yellow.png";
} else if (status == 2) {
return "media:///circle_red.png";
}
return "media:///circle_green.png";
}
The TableView looks like this:
[attachment=0]status.PNG[/attachment]
Is there any other setting to do at the label in which I want the image to be displayed? Or anything else?
Set your field to HTML_AREA, then return a html with the img embedded:
function status_icon() {
var html = '<html><body><img src="';
if (status == 1) {
html += "media:///circle_yellow.png";
} else if (status == 2) {
html += "media:///circle_red.png";
} else {
html += "media:///circle_green.png";
}
return html + '"></img></body></html>';
}
You might want to add some style as well to place your image correctly inside the field, and make sure that the scrollbars property is set to"V:n H:n".