Follow the solution in this post.
However, I did not include anything in the Depends On field even though the original poster suggests var1 = frm.doc.{against_sales_order} and another person suggests var1 = frm.doc.{fieldname}.
After creating the Custom Script in the solution, just go to Print Format Builder and add So No wherever you wish.