How to skip printing if doctype has no values

I have several child table already displayed in print format view. Now I want if the table has no values not to print at all(print only when it has values). Am missing the part of adding the code for skipping to print. Please help!

    {% for drug in doc.drug_prescription %}
	    {% if (drug.prescribe != 0) %}
			    <TD>{{ drug.prescribe }}</TD>
			    <TD><br>{{ drug.drug_code }}</TD>
			    <TD><br>{{ drug.dosage }}</TD>
		    	    <TD><br>{{ drug.period }}</TD>
			    <TD><br>{{ drug.dosage_form }}</TD>
	    {% endif %}
    {% endfor %}