Conditional Paragraph based on detail table field

I have a series of detail tables that have paragraphs preceding them as titles. There are times when the data for the detail table does not exist in the data. I am trying to suppress the title from showing when this occurs. i.e.:

Table_Title
DetailTableRow
DetailTableRow

When there is no data for the detail table just the title appears:

Table_Title

I am trying to make it conditional on the detail rows with the script below but I get the message “unknown table”

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

When there is no data the table in the scripts pane has a red ‘x’ and shows “unknown Table”. So I tried both of these but still no luck:

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

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

Can anyone help?

Thanks!

Is your Table_Title using an ID or a class?

Actually, I did not have that paragraph set to use either yet. I just right clicked on it and chose make conditional.

Try this:

if(!('Audi_Comm_Instr' in record.tables)){
    results.hide();
}