OL Learn

How to hide a static value in a detailed table

Hi - I have a detailed table where I hard coded a percent sign in the cell. I have a script that says if the value is equal to 0.0000 then change to ‘Unavailable’. This works fine. Except my result is this - Unavailable%. My script is below. My question is how do I hide the % in the detailed table if equal to 0.000. My result should be - Unavailable

results.each(function(index) {
var field, result = “”;

field = record.tables["investment"][index].fields["fnd_ExpRatio"];
if (field != "0.0000") result += field;
	this.html(result);

if( field == “0.0000”) {
result = “Unavailable”;
}

this.html(result);
});

Thank you

I would remove the hard coded percent entirely and add it into your if statement instead.

this.html(result +'%')

This way it only gets added if that field has a valid number.

Worked perfect. I was making it more complicated than need be!! Thank you