how do i grab these records?

hi im new on crystal so please bear with me
for example this is my data

EMPID     COMPANY     DEPT
12345          100              22
23456           100             23
34567           200             33
45667           200              34
11111           200              35
11112           200               36
11113           200               37
11114            300              11
11115            300               12
11116            300               13
11117            300                14
11118            300                15

lets say I need to capture empID in company 100 and on 200 I only need dept 35,36 and on 300 I need depts 11,12,13
how will I be able to get that? lets say there are more data in it with lots of departments but I only need specific ones from specific companies
raman takharAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pawan KumarDatabase ExpertCommented:
Which database are u using?
0
Raghavendra HullurSoftware DeveloperCommented:
Hi,
If you are using command object for free hand sql, then you can include where clauses for the respective conditions. And if you want to do it thru parameters at Crystal Reports level, then you can use record selection with filter conditions using the parameter values. Provide more details on how you want to achieve this.
0
raman takharAuthor Commented:
ok let me make it clearer sorry. im using crystal reports. So every employee has a Company # and a Dept #. I need to capture specific Company numbers with specific Department #. like on the table I showed earlier. what would be the best way to capture them. I tried doing on record selection filtering Companys and filtering departments but there are similar department numbers between companies for example company A can have dept 1 and company B can have dept 1 also and so does C. but lets say I only need company 1 from A and not from B and C.
0
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

raman takharAuthor Commented:
so I need to capture all in Company 700 and 701 and
In in company 400, select only the following depts:
7550, 7800, 7801,7802,7803,7805,7806,8133,8800,8801,8807,8808,8813 and
In company 100, select only the following departments:
7550,7551,7556,7557,7800,8800,8813

so if you see the departments in the Companies are similar. but for some I have to capture everyone and for some I need specific ones
0
mlmccCommented:
You can use the SELECT EXPERT to setup a filter for your data.

Something like this

(
	{Company Field} = [700, 701]
)
OR
(
	{Company Field] = 400
	AND
	{Dept Field} = [7550, 7800, 7801,7802,7803,7805,7806,8133,8800,8801,8807,8808,8813]
)
OR
(
	{Company Field] = 100
	AND
	{Dept Field} = [7550,7551,7556,7557,7800,8800,8813]
)

Open in new window


mlmcc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Raghavendra HullurSoftware DeveloperCommented:
You haven't confirmed whether you are using command object or direct tables in the Crystal Reports.
If you have command object used, then you can include the filter conditions in command query via where clause directly inside command object.
If not, then as mlmcc said, you need to have record select expert with slightly modified condition from mlmcc as you have multiple departments to check. Here it is:

(
      {Company Field} in [700, 701]
)
OR
(
      {Company Field] = 400
      AND
      {Dept Field} in [7550, 7800, 7801,7802,7803,7805,7806,8133,8800,8801,8807,8808,8813]
)
OR
(
      {Company Field] = 100
      AND
      {Dept Field} in [7550,7551,7556,7557,7800,8800,8813]
)
0
raman takharAuthor Commented:
it works. Thank you guys
0
mlmccCommented:
Raghavendra Hullur - There was no need to change the SQL I provided.  Crystal converts it automatically for you so you can use = with lists as I did.

mlmcc
0
Raghavendra HullurSoftware DeveloperCommented:
Thanks mlmcc, is that a new feature or is it like that from earlier versions?
0
mlmccCommented:
Been like that since at least CR8
I tried it before I posted to make sure

mlmcc
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.