Solved

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

Posted on 2015-02-09
6
91 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 33

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 33

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 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

12 Experts available now in Live!

Get 1:1 Help Now