placing a conditional script on a dynamic table

Hi - I am wondering if you are able to place a conditional script on a dynamic table to hide a row if two values meet the criteria? I am able to come up with something that hides the whole table but need it to hide just the rows it effects. For example I have three columns and if Allocations and Tolerance equal 0 then I need to hide that particular row. What I have so far is below:

results.each(function(index) {
var Allocation = record.tables[“PeerGroup”][0].fields[“Allocation”];
var Tolerance = record.tables[“PeerGroup”][0].fields[“Tolerance”];

     if (Allocation == "0" && Tolerance == "+/-0"){
   results.attr("data-conditional", "");
 results.hide();

} else {
results.show();
}});

Thank you

Hi ahaddad,

Try the script below. Change the selector to match the table rows in the tbody section of your table. The script iterates over the rows and uses that index to retrieve the respective values from the detail table. In case the values match it will hide the current table row (this).

Selector: #table_1 tbody tr

Script:

results.each(function(index) {
    var allocation = record.tables['PeerGroup'][index].fields.Allocation;
    var tolerance = record.tables['PeerGroupl'][index].fields.Tolerance;
    if(allocation == '0' && tolerance == '+/-0') {
        this.hide();
    }   
});

Hope this is of some help,

Erik

This was perfect !! Thank you. I figured I had to be selecting it by row somehow but couldn’t figure that out.

Thank you again!!!

Hi Erik,

I have a detail table that has a column containing image codes. I need to remove one table row if both instances of the image codes exist. e.g.

62

68

69

89

I need to remove the row 68 if 89 exists. Any pointers?

Much appreciated.

Regards,

S