Hello,<br>
<br>
I have read that you will have to allow for a wildcard at the parameter prompt.<br>
<br>
Be sure to use the "Like" or "LooksLike" operators in the Select Wizard, when placing the parameter.<br>
<br>
To allow for all values, be sure to have the wildcard "*" as the default value.<br>
<br>
Hope this works for you.<br>
<br>
MO
Another way of doing this with SQL data sources is as follows.<br>
Assume your parameter is {?EmployeeID}. Put the value of "All" as the default value. In your WHERE clause in the SQL statement, put the line <br>
WHERE ({?EmployeeID} = "All" OR {?EmployeeID} = Table.EmployeeID)<br>
This will return all employee IDs when the default value "All" is used, or if a specific EmployeeID is entered, it will return just that. Of course, this assumes that there does not exist an employee with a valid employeeID of "All"!<br>
<p>Malcolm Wynden<br><a href=mailto:wynden@island.dot.net>wynden@island.dot.net</a><br><a href= > </a><br>
If you want to select all values when a parametet is left null, you can build a formula such as:<br><br>(if {?parameter} = " " then 1=1 else (workorder.value) = {?parameter})
MaintenanceGroup has it - here's my two cents...<br><br>if {?Parameter} = " " then true<br>else<br>{MyDatabase.Myfield} = {?Parameter}<br><br>For a more user friendly version I often use the word "All" as the default value and make the user enter something different. The code would then be:<br><br>if {?Parameter} = "All" then true<br>else<br>{MyDatabase.Myfield} = {?Parameter}<br><br> <br><br> <p>Cody ford<br><a href=mailto:codyford@yahoo.com>codyford@yahoo.com</a><br><a href= > </a><br>VB, VBS, Seagate Info/Crystal Reports<br>
The logic is basically this: if the parameter field contains a discrete value, then USE that value to match against a field in the database; otherwise just ACCEPT whatever value happens to be in that field in the database.
The LIKE "*" version is the only method of those listed above that gets converted into SQL to be passed to the database. However using LIKEis not very efficient when the parameter has an actual value in it (ie not *). Has anybody worked out a solution to this problem that does result in the SQL being written, but does not use LIKE? Icytrue
Using the Crystal Query Designer with parameters allows you create more efficient SQL, at the expense of having to use a less than robust product. Passing parameters to stored procedures is a more reliable way of achieving this same goal. Malcolm Wynden
malcolm@wynden.net
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.