Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Optional Parameters Crystal XI Rev2

Status
Not open for further replies.

jlr123

Technical User
Feb 24, 2014
117
US
I have two fields that I want users to be able to select either one. Need help to set up.
Fields are: {SO_SalesOrderHistoryDetail.SalesOrderNo} = {?SO#} or {SO_SalesOrderHistoryHeader.OrderDate} = {?Sales Order Date}

Thanks for your assistance.

 
(if isnull({?SO#} then ({SO_SalesOrderHistoryHeader.OrderDate} = {?Sales Order Date})
else ({SO_SalesOrderHistoryDetail.SalesOrderNo} = {?SO#}))
 
This does not allow me to enter a Sales Order No.
Thanks.
 



(if isnull({?SO#} then ({SO_SalesOrderHistoryHeader.OrderDate} = {?Sales Order Date})
else
if isnull({?Sales Order Date})) then ({SO_SalesOrderHistoryDetail.SalesOrderNo} = {?SO#})
else ({SO_SalesOrderHistoryDetail.SalesOrderNo} = {?SO#} and {SO_SalesOrderHistoryHeader.OrderDate} = {?Sales Order Date}) )

This let's you enter either parameter or both.






 
This is the parameter and it still does not work. I still have to put something in both ranges.

(if isnull({?SO#}) then ({SO_SalesOrderHistoryHeader.OrderDate} = {?OrderDate})
else
if isnull({?OrderDate}) then ({SO_SalesOrderHistoryDetail.SalesOrderNo} = {?SO#})
else ({SO_SalesOrderHistoryDetail.SalesOrderNo} = {?SO#} and
{SO_SalesOrderHistoryHeader.OrderDate} = {?OrderDate}))
 
I think the problem you are encountering is that Optional Parameters did not become available until CR2008 (I have XI and they certainly aren't available in that version).

Without the ability to mark a parameter as Optional, the only parameter types you can avoid entering data into are Strings (empty strings are still strings).

The only option you have would be to set the default {?SO#} parameter to something like 0, and the default {?OrderDate} parameter to something like 1/1/1900, and provide instructions to end users to leave the defaults unchanged if they want them ignored.

Your record selection formula would then look like this:
Code:
(
	{?SO#} = 0 or
	(
		{?SO#} <> 0 and
		{SO_SalesOrderHistoryDetail.SalesOrderNo} = {?SO#}
	)
)
and 
(
	{?OrderDate} = Date(1900,1,1) or
	(
		{?OrderDate} <> Date(1900,1,1) and
		{SO_SalesOrderHistoryHeader.OrderDate} = {?OrderDate}
	)
)

Hope this helps.

Cheers
Pete

 
This works but the SO # was a string and I had to set to 'z' default. thanks for your assistance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top