Solved

How to filter multiple row of records in DataTable in the Dataset

Posted on 2015-02-09
6
93 Views
Last Modified: 2015-02-11
I am currently filtering column name : SCR_DPY_SEQ which has records certain records by using the below syntax.

Syntax filters only few records and not all..

And this syntax is very cumbersome to manage .. Is there a better way to filter Multiple row of records in a Database within the Dataset ??

 
PTDs.Merge(ds.Tables("p_tree").Select("SCR_DPY_SEQ <> '30003039' AND SCR_DPY_SEQ <> '30003040' AND SCR_DPY_SEQ <> '30003041' AND SCR_DPY_SEQ <> '30003042' AND SCR_DPY_SEQ <> '30003043' AND SCR_DPY_SEQ <> '30003121' AND SCR_DPY_SEQ <> '30003122' AND SCR_DPY_SEQ <> '30003123' AND SCR_DPY_SEQ <> '30003124' AND SCR_DPY_SEQ <> '30003125' AND SCR_DPY_SEQ <> '30003203' AND SCR_DPY_SEQ <> '30003204' AND SCR_DPY_SEQ <> '30003205' AND SCR_DPY_SEQ <> '30003206' AND SCR_DPY_SEQ <> '30003207' AND SCR_DPY_SEQ <> '30003285' AND SCR_DPY_SEQ <> '30003286' AND SCR_DPY_SEQ <> '30003287' AND SCR_DPY_SEQ <> '30003288' AND SCR_DPY_SEQ <> '30003289' AND SCR_DPY_SEQ <> '30003367' AND SCR_DPY_SEQ <> '30003368' AND SCR_DPY_SEQ <> '30003369' AND SCR_DPY_SEQ <> '30003370' AND SCR_DPY_SEQ <> '30003371'"))

Open in new window

0
Comment
Question by:chokka
  • 3
  • 2
6 Comments
 
LVL 47

Expert Comment

by:Wayne Taylor (webtubbs)
ID: 40599325
You could use this....

PTDs.Merge(ds.Tables("p_tree").Select("SCR_DPY_SEQ NOT IN ('30003039', '30003040', '30003041' , '30003042', '30003043', '30003121', '30003122', '30003123', '30003124', '30003125', '30003203', '30003204', '30003205', '30003206', '30003207', '30003285', '30003286', '30003287', '30003288', '30003289', '30003367', '30003368', '30003369', '30003370', '30003371')"))
0
 
LVL 34

Accepted Solution

by:
Mike Eghtebas earned 500 total points
ID: 40599425
or possibly:

PTDs.Merge(ds.Tables("p_tree").Select("SCR_DPY_SEQ < '30003039' OR SCR_DPY_SEQ NOT >'30003371'"))

revised...
0
 

Author Comment

by:chokka
ID: 40599923
There is another column name : GROUP_CODE, i need to filter SG.

This will reduce the code.

PTDs.Merge(ds.Tables("p_tree").Select("GROUP_CODE not like SG"))

How to use - SELECT NOT LIKE
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 34

Expert Comment

by:Mike Eghtebas
ID: 40599944
SELECT * From Table1 As t Where t.Name Not In(Select .t2.Name From Table2 t2)

This is one out of many variations.
0
 

Author Comment

by:chokka
ID: 40599968
Thanks , by any chance - can you please rewrite your syntax in a compilable ..
0
 

Author Closing Comment

by:chokka
ID: 40604814
Thanks
0

Featured Post

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 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