Overview of Crystal Reports - Part 4steemCreated with Sketch.

in #technology7 years ago

Hi Steemians,

This post is the fourth of the series of blogs I am writing on Reports design tool Crystal Reports. Below are the links for earlier posts in that order.

  1. https://steemit.com/technology/@coolguy123/overview-of-sap-crystal-reports-part-1-2017926t16715219z
  2. https://steemit.com/technology/@coolguy123/overview-of-crystal-reports-part-2
  3. https://steemit.com/technology/@coolguy123/overview-of-crystal-reports-part-3-2017101t204541470z

We saw about history, versions, vendors and how to create a data source for Crystal Reports along with creating a simple report using command object in earlier posts.

In this post, let’s see how to filter report data using dynamic filter conditions called as “Parameters”.

Parameters can be used in 2 different ways in Crystal Reports.

  1. If we are using Command Object for pulling data from database as we saw in previous post, then we can use parameters created at Command Object level
  2. If we are not using Command Object or if there is a specific requirement to create parameters at report level, then we can create parameters at report level and use the same in something called as “Record selection” to filter the data.

Let’s see each of these with some screenshots for better understanding.

Query Level/Command Object Level parameters:

Using the Command Object we had created in previous post, we will continue with parameter creation. Check below screenshot where in, the highlighted parameter creation options.

CreateParameter.JPG

As we can see, once we click “Create”, we get a parameter creation screen, where, we need to enter parameter name, prompting text, data type of the parameter and default value if any.
Note the checkbox for “Allow Multiple Values”. If we check this, then we can create a multi value parameter which provides an option to filter report data with more than one value.
Let’s create a multi value parameter for Department ID.

Once we include the required information as in above screen and click OK, we get the parameter created.

ParameterCreated.JPG

Now, we can use this parameter to filter the data by using it into the where clause of the query we have as in below screenshot.

ParamInclusion.JPG

All we need to do is create an additional where clause condition like and d.department_id in and double click the newly created parameter to use it along with where clause. The highlighted part in above screen has the condition.

P.S: The in condition in the where clause d.department_id in is required as we have created a multi value parameter.
Once we click OK, we will be taken to the screen as below, where in we need to enter valid values for initial filtering of data. Note the values 10 and 50 used as filter conditions for Department ID.

ParamValues.JPG

Click OK and we can see that the report output data is filtered for departments 10 and 50 only.

ReportOutput.JPG

This concludes the first part of parameter creation i.e. Parameters at Command Object Level.
Now, let’s see the second part, i.e. creation of parameter at report level.
We will continue with the report we modified in the above method.

Report Level Parameter Creation:

FieldExplorer.JPG

Please check the right side of above screenshot, there is a Field Explorer which has all the objects used in report.
There is a link for Parameter Fields as well and we can see dept_id parameter we created in above steps.

Now, we will create a report level parameter on field Employee ID by right clicking on Parameter Fields and selecting New with parameter name as Employee ID with options set as highlighted in below screen. Note, “Allow multiple values” set to True to allow filtering for multiple Employee ID’s.

ReportLevelParamCreation.JPG

Newly created parameter will not be used for filtering the data until we use it as a sql condition using something called as Record Selection.

Navigate to Report Tab  Selection Formulas  Record as in below screenshot.

RecordSelection.jpg

We need to write the filter condition manually in the record selection screen as below.

RecordSelectionClause.jpg

Note the record selection where clause highlighted. Command.EMPLOYEE_ID is the database field and {?Employee ID} is the report level parameter we had created.
Click on Save and Close, we will be asked to enter the Employee ID values. I have selected 200, 120, 121, 122 and 127 Emplyee ID’s.

EmployeeIDFilter.JPG

Click OK and see that the Report data is refreshed to include only the Employee details we have filtered.

ReportOutput2.JPG

That completes the intention of this post. i.e Creation of parameters in Crystal Reports to filter Report Data.

I hope you enjoyed reading the content.

Please follow, resteemit, upvote and provide your comments.

Sort:  

Congratulations! This post has been upvoted from the communal account, @minnowsupport, by coolguy123 from the Minnow Support Project. It's a witness project run by aggroed, ausbitbank, teamsteem, theprophet0, someguy123, neoxian, followbtcnews/crimsonclad, and netuoso. The goal is to help Steemit grow by supporting Minnows and creating a social network. Please find us in the Peace, Abundance, and Liberty Network (PALnet) Discord Channel. It's a completely public and open space to all members of the Steemit community who voluntarily choose to be there.

@resteem.bot
Resteemed to over 5000 followers and 100% upvoted. Thank you for using my service!
Read here how the new bot from Berlin works.
@resteem.bot

This post received a 49% upvote from @morwhale team thanks to @coolguy123! For more information, click here! . this is @originalworks . steem @steemprice BTC

$4229.64 USD/BTC
Volume: 42119.0 BTC ($178148196.82 USD)
Last Updated Thu Oct 5 02:59:27 2017

The @OriginalWorks bot has determined this post by @coolguy123 to be original material and upvoted it!

ezgif.com-resize.gif

To call @OriginalWorks, simply reply to any post with @originalworks or !originalworks in your message!

To enter this post into the daily RESTEEM contest, upvote this comment! The user with the most upvotes on their @OriginalWorks comment will win!

For more information, Click Here! || Check out our contests as well!
Special thanks to @reggaemuffin for being a supporter! Vote him as a witness to help make Steemit a better place!

As a follower of @followforupvotes this post has been randomly selected and upvoted! Enjoy your upvote and have a great day!

Congratulations @coolguy123! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Congratulations! This post was randomly selected and upvoted by @resteemr!


@resteemr is a new low price resteem service.
Check what @resteemr can do for you - Follow & Earn.

Coin Marketplace

STEEM 0.20
TRX 0.12
JST 0.029
BTC 60632.95
ETH 3382.33
USDT 1.00
SBD 2.51