Solved

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

Posted on 2015-02-09
6
90 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

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

11 Experts available now in Live!

Get 1:1 Help Now