Im having trouble with having this formula. I need to first check if it is CS or if its PT as the uom for the sales order. When it runs if PT is true and CS is false then its not ignoring the divide by zero value being returned by CS if statement.

((if {t_pick_detail.uom} = 'CS'
then {t_pick_detail.planned_quantity} /({t_item_uom.units_per_layer} * {t_item_uom.layers_per_uom}))
(if {t_pick_detail.uom} = 'PT'
then {t_item_uom.conversion_factor} /{t_pick_detail.planned_quantity}))