Hi Evie - I found your videos on you tube and absolutely love them. Very very helpful - thank you for doing them !!!
I just watched the video on snippets. I created a snippet and it works (sort of). What I did was take the header of my existing table and added on row that says ‘no data available’. I want to display this when a field is equal to 0. I tried to create a script with if/else but I can’t get it to work. Is this possible to load a snippet based on a condition?
Since sending this question I have actually found a solution. I created two snippets- one with the dynamic table data and one with the ‘no data available’. I got the conditional script to work, however my table with the conditional data is not displaying. It looks like mytable in design view does (with the variables and notthe actual data).
I added two snippets. One with out data and one with data. The one with data I want to show if >0. the other one <0. I can get it to work but my data is dynamic and does not populate if >0. There are three tables that are dynamic to each other. I had trouble getting them to work the right way.
Here is what I have :
var contents = loadhtml(“snippets/DFSA_NOdata.html”);
var Ppts = 1;
results.each(function(index) {
Ppts = Ppts + record.tables.DFSAPlans[index].fields.UniqueParticipants8;
});
if (Ppts>0){
results.loadhtml(‘Snippets/DFSA_data.html’,id=“DFSAPlans”);
}else{
results.loadhtml(‘Snippets/DFSA_NOdata.html’);
}
Based on this I should be showing my table with data. I get my table but with the variables and not the actual data. Do you know how call the results into the snippet?
thanks you so much for your help!!! I am fairly new to this so I am sure there are better ways, I just dont know them.
All roads lead to Rome Attached sample template contains three scenarios to conditionally show the ‘No data found!’. I’ve chosen approaches that do not use snippets and loadhtml() and placed the respective information in the main text flow. I believe this makes it’s easier to style and view the tables in the Design view.