Solved

How to highlight data only if it meets criteria comparing against the rest of the data.

Posted on 2013-02-06
3
366 Views
Last Modified: 2013-02-21
Hi Experts, I have a complicated issue.
I need to highlight rows of data if it meets a set of criteria. It is simple to highlight the row if it meets 3 sets criteria E.g. If column1=”Dog”, Column2=”Claws” and Column3=”Hungry” then highlight row. That is easy to do, however what I want to do is look at the rest of the rows of data for that day and see if Column2 and Column3 also appear but with a different column1.  This is very confusing to explain. I will use false data but hopefully you will see what I am trying to do. Say I have a pet cage and I don't mind all (column1) dogs, cats, bear’s etc mixing in that same cage. However if there are more than two types of column1 plus Column2=”Claws” and column3=”Hungry” then I want those rows highlighted so I don’t put them in the same cage. That is only if the column1 types are different. If for example there are 3 rows with dogs and they all have “Claws” and are “Hungry” they don’t need to be highlighted.  Not a very good example but best I could come up with to explain my problem. Is there a way to do this using custom code? I have studied programming but not for 10 years, so I know the concepts but I am very rusty.  I guess I just need a little guidance I how I might go about doing this. If It can't be done then I would like to know this as well. Many thanks for your help.   One more thing, I can only do the programming in the Report. I cannot setup procedures or anything directly to the Database. This needs to be done via the custom code in the report as we use a ODBC connection.
0
Comment
Question by:bruskhickory
3 Comments
 
LVL 10

Assisted Solution

by:Mez4343
Mez4343 earned 250 total points
ID: 38862142
First thought is to create a new DataSet (SQL Query) that will return row(s) based on the conditional criteria you need. This may involve creating a somewhat complex SQL query to do everything you detailed so you you need some decent sql skills. If you can create SQL result then you can check the result in your BackgroundColor property with a simple =IIF statement to do the highlighting. If you want to try SQL and need some help, post a sample db with requirements.

Custom code is an option but I wouldnt presonally put in ODBC db access calls there because you would need to handle errors and the like. If you need a starter reference for doing Custom Code check here. http://msdn.microsoft.com/en-us/library/ms156028.aspx
0
 
LVL 23

Accepted Solution

by:
Ioannis Paraskevopoulos earned 250 total points
ID: 38862623
Select a.column1, a.column2, a. column3, b.species from table1 a join
(Select column2, column3, case when max( column1)<>column2 then 'Different' else 'same' end as Species from table1 group by column2, column3) b
On a.column2 = b.column2
and a.column3 = b.column3


Try the above and see if it gets you the data you want.

Giannis
0
 

Author Closing Comment

by:bruskhickory
ID: 38916378
Sorry for late feed back I had to put this issue down the list. I still have yet to try it out.
Thanks for your help.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Hi All, I am here to write a simple article to move SSRS (SQL Server Reporting Services) reports from one server to another. When I have faced the same issue to move reports those were developed by developer on development server and now need to …
A recent questions about how to add SSRS named instances, couldn't find any that talks about SQL server 2008, anyway I decided to help by creating some screen shots. The installation is straightforward, you just pop the SQL server 2008 installati…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video discusses moving either the default database or any database to a new volume.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now