Hi - I have this simple condition where I am getting an error I have never seen before. I have worked with conditions on fields in tables a lot. I even created a new designer template and recreated two fields in a table (to keep it simple). I then used the conditional wizard to create the show/hide condition. I was initially was trying to create condition to say if = to yes then show (“*”). I couldn’t get that to work so I was troubleshooting it and went real basic with show/hide and that’s when I received this error. The error message is as follows:
Can not call property tables in object record #1. It is not a function, it is an “object”
I used the conditional wizard then had to go in and edit it so I could use the table name then field name.
if (record.tables(“AssetSummaryItem”)[0].fields[“QDIA”] == “YES”) {
results.show();
} else {
results.attr(“data-conditional”, “”);
results.hide();
}
Thank You
I think the issue is just syntax here. You should be using square brackets on the table name, not paranthesis.
record.tables[“AssetSummaryItem”][0].fields[“QDIA”]
Hi - I went back and reviewed the condition. Even started over - Again. I am not getting any errors however, the condition is not working. Displays “*” for everything.
results.each(function(index){
var QDIA = record.tables[“AssetSummaryItem”][index].fields[“QDIA”];
logger.info(QDIA);
if (record.tables[“AssetSummaryItem”][0].fields[“QDIA”] === “YES”) {
results.html(“*”);
} else {
results.hide();
}});
Thanks
Your condition is set to always look at the first item in AssetSummaryItem ([“AssetSummaryItem”][0]). So if the first item is YES, then all of them are going to show *.
Replace the 0 with your index variable so that you’re looking at the current record on each loop instead of the first record.
I did that also and there are no errors and no results at all. I even tried to copy and paste a conditions that works and make changes accordingly.
if (record.tables[“AssetSummaryItem”][index].fields[“QDIA”] === “YES”)
comment out your results.hide(); and see what you get.
No change. I even changed it to -
results.html(" ") to see what I would het. Still no cahnge