How to Create Select Expert Formula in Crystal Reports

(if {?Batch No} = “ALL” then {SO_InvoiceHeader.BatchNo} in “00000” to “ZZZZZ” else

{SO_InvoiceHeader.BatchNo} = {?Batch No}) and

( if minimum({?Order No}) = “ALL” and maximum({?Order No}) = “ALL” then

{SO_InvoiceHeader.SalesOrderNo}in “0000000” to “ZZZZZZZ” else

{SO_InvoiceHeader.SalesOrderNo} = {?Order No}) and

(if {?Customer No} = “ALL” then {SO_InvoiceHeader.CustomerNo} in “000000” to “ZZZZZZZ” else

{?Customer No} = {SO_InvoiceHeader.CustomerNo})