Hide Entire Rows of Dynamic Table

I apologise, I’m a nubie at programming…

I have a dynamic table that uses detail and non-detail fields

I want to hide the entire row of the table if a particular field(s) value is equal to 0.00

Is this possible?

Hi Duncan,
Without knowing the exact specifics, you could use a conditional script within the table similar to the following to hide the row:

if (record.tables.detail[“{field}”] == “0”) {
results.attr(“data-conditional”, “”);
results.hide();
} else {
results.show();
}

Best Regards

Justin Leigh
Technical Support (Asia Pacific)

This can also be handled within an expanded Text Script. The following hides the parent of the table cell (e.g. the row) when the value matches “0.00”.

Erik

results.each(function(index) {
	var field, result = "";
	
	field = record.tables["detail"][index].fields["ItemShipped"];
	if (field !== "") result += field;
	
	if( field == "0.00") {
		result = "";
	}
	
	this.html(result);
	
	// Hide the parent (row)
	if( field == "0.00") {
		this.parent().hide();
	}
	
});
1 Like

Fantastic, thank you

How would I modify this if I’m looking for the absence of a value in a specific field.
Such as the field ItemShipped = “” or null instead of the “0.00” value in the example?

I have two cases with a similar ask

  • 2020.2 using a Dynamic Table with 4 columns, but need to hide the entire row if there is a null value in column 1
  • 2018.1 using a Dynamic Table with 3 columns, but need to hide the entire row if there is a null value in column 2

Simply use if(field). That expression returns false if field is empty or null.

Sorry for what’s probably a very basic question but I guess I create this as a text script, but then how do I apply it to the row?

It should be matter of assigning a class name to the table cell and use that as the selector for your script. Have a look at the following article:

1 Like