wrap formula for constraints in where clause