Display a field in Table if a Record exists

I have table where there are three posibilities

  • 0 record
  • 1 or 2 records.

if it is 0 I wish to hide the field and display First record in on form and second record in the next form.

I have a script something like below.

results.each(function(index) {
var field,result = “”;
if(index>0){
field = record.tables[“xxxx”][index+0].fields[“yyy”];
this.html(field);
}else{
this.parent().hide();
}
});

I get a error stating "Error read property ‘0’ from undefined…

I think you can simply right click on your table and use the “make conditional” button.Screenshot
Select the Datafield that you want to use as your condition and leave the Value blank, this will hide the table when there is no value for that record and display it when there is any value. Let me know if I am missing something else.