{"id":74,"date":"2007-12-30T21:28:53","date_gmt":"2007-12-31T04:28:53","guid":{"rendered":"http:\/\/members.crystalreportsbook.com\/crystal-reports-xi\/4-8-filtering-with-parameters\/"},"modified":"2010-11-17T18:11:49","modified_gmt":"2010-11-18T01:11:49","slug":"4-8-filtering-with-parameters","status":"publish","type":"post","link":"http:\/\/www.crystalreportsonlinetraining.com\/training\/4-8-filtering-with-parameters\/","title":{"rendered":"4.08 Filtering with Parameters"},"content":{"rendered":"<h1>Filtering with Parameters<\/h1>\n<p>The first part of this chapter showed how filtering data lets you customize a report to fit a specific user&#8217;s needs. The only drawback to this approach is that you have to know in advance what that user&#8217;s needs are when you are designing the report. And if different users have different needs, then you either have to save a separate copy of the report for each variation or the have each user customize the report themselves. Neither of these options is a very practical approach. A much better solution is to create a filter that uses parameters to prompt the user for their input prior to printing the report. This lets you create one report that satisfies many users.<\/p>\n<p>In their most basic form, report parameters are simply a means of asking the user questions about what they want printed. When the user opens the report, he or she is prompted with a question and the answer is used within the report (e.g. for filtering data). Some examples of typical questions are, &#8220;What sales district do you want to report on?&#8221; and &#8220;What is the minimum sales amount you want to see?&#8221; Questions such as these let the user take a report that was designed to be used by multiple people and only view the data that he or she is interested in. The biggest benefit is that you don&#8217;t need to save a separate copy of the report for each user. New parameter values can be entered each time the report is viewed. Figure 4-5 shows a parameter prompting the user for a report date and the print range.<\/p>\n<p>         <a href=\"http:\/\/www.crystalreportsonlinetraining.com\/Images\/CRXI\/Ch04\/image013.png\"><br \/>\n            <img decoding=\"async\" src=\"http:\/\/www.crystalreportsonlinetraining.com\/Images\/CRXI\/Ch04\/image014.jpg\"><\/img><\/a><br \/>\n         <b>Figure 4-5. Parameter prompt dialog box.<\/b><\/p>\n<p>In this example, the user is being prompted to enter two parameters. The first being an Order Date and the second is a date range. You can see a calendar displayed on the screen as well. Crystal Reports lets the user enter dates by typing them in directly or picking the date from this calendar control.<\/p>\n<blockquote><p>Question: I would like to change the prompting dialog box to match our corporate color scheme. Is it possible to modify the prompting window?<\/p><\/blockquote>\n<blockquote><p>Answer: Yes, you can modify how this window is formatted. Crystal Reports uses a CSS file for formatting the objects displayed. The advanced tutorial at the end of this chapter shows you the details of modifying the prompting window.<\/p><\/blockquote>\n<p>Parameters are used for many purposes. As I mentioned already, the single biggest purpose is filtering data based upon a user&#8217;s needs. But there are many other uses for parameters. They are also used to customize the report format. For example, a sales report can highlight in red all sales persons whose quarterly sales fall below a certain level. A standard report can be customized to hide report objects that aren&#8217;t relevant to the user. Requiring a user to enter their User ID lets you hide or show sensitive information. And in the Chapter 3 Advanced Tutorials, you saw how to use parameters to perform dynamic grouping and sorting. Creative use of parameters gives you a multitude of ways to make a report respond to a user&#8217;s needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Filtering with Parameters The first part of this chapter showed how filtering data lets you customize a report to fit a specific user&#8217;s needs. The only drawback to this approach is that you have to know in advance what that user&#8217;s needs are when you are designing the report. And if different users have different [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,1],"tags":[],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-chapter-4-filtering-data-with-parameters","category-crystal-reports-xi","entry"],"_links":{"self":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/comments?post=74"}],"version-history":[{"count":1,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/74\/revisions"}],"predecessor-version":[{"id":1411,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/posts\/74\/revisions\/1411"}],"wp:attachment":[{"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/media?parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/categories?post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.crystalreportsonlinetraining.com\/training\/wp-json\/wp\/v2\/tags?post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}