If eslse statement?

ill create a custom print format. its posible if the discount = 0 then the discount field on printed form will not added to my printed form. ill try to code but is not working. how to hide this discount if discount is zero?

	{% if disc_amount1 != 0.0 -%}
		<div class="f2-1">Discount1</div>
		<div class="f2-2">
				-&nbsp;{{doc.get_formatted("disc_amount1")}}
		</div>
	{%- else %}
	{%- endif %}
		</br>
	{% if disc_amount2 != 0.0 -%}
		<div class="f3-1">Discount2</div>
		<div class="f2-2">
				-&nbsp;{{doc.get_formatted("disc_amount2")}}
		</div>
	{%- else %}
	{%- endif %}
		</br>
	{% if dis_amount3 != 0.0 -%}
		<div class="f4-1">Discount3</div>
		<div class="f2-2">
				-&nbsp;{{doc.get_formatted("disc_amount3")}}
		</div>
	{%- else %}
	{%- endif %}

Hi @Denmark_Del_Puso! Try putting 0 instead of 0.0 .

2 Likes

thanks a lot its working. :slight_smile: @creamdory

1 Like