473,395 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

filter a column with multiple values

nev
251 100+
i declared 2 datatables:

dim dtt1 as datatable = ds.datatable1
dim dtt2 as datatable = ds.datatable2

dtt1 has firstname, lastname columns
dtt2 has firstname column

when i filter dtt1 by lastname, there will be a lot of firstnames

what can i do to filter dtt2 by all those firstnames?

i can filter a column by 1 value like .rowfilter= "firstname='" & firstname1 & "'"

i want to know how to filter a column with multiple values (taking note that the firstname may have none to a lot of values). if i do this...

.rowfilter="firstname='" & fn1 & "AND firstname='" & fn2 & " AND so on...'"

this will take forever. is there any way i could filter dtt2 with all the firstnames i got after filtering dtt1?
Nov 21 '07 #1
7 2260
Shashi Sadasivan
1,435 Expert 1GB
Iterate throug each row of the grid
and check if the isRowVisible(RowHandle) is true.
then use that row to fetch the id,s and create the AND statment for the next grid

I am using the context of gridview beacause it has the RowFilter Property, while datatables i think dont have that.
Nov 21 '07 #2
nev
251 100+
Iterate throug each row of the grid
and check if the isRowVisible(RowHandle) is true.
then use that row to fetch the id,s and create the AND statment for the next grid

I am using the context of gridview beacause it has the RowFilter Property, while datatables i think dont have that.
ok, i'll check it out. thank you.
Nov 21 '07 #3
nev
251 100+
i was thinking is there a way i can relate the 2 datatables so that if i filter dtt1, dtt2 filters itself with respect to the firstnames in dtt1?

it is because if i do code like the one suggested, and say i have over 100 records, that will really take time to process.
Nov 21 '07 #4
Shashi Sadasivan
1,435 Expert 1GB
Hi,
Sorry about my previous post.
I have been using some third party tools since I plunged into windows apps.
and they have beautiful support for filtering.

Coming back to your query, in your case you might be using a dataView to change the filter.

once the filter is changed, I think the ListChanged Event of the dataview is triggered.

Once you reach here you can check if the row isvisible as mentioned before.

cheers
Nov 21 '07 #5
nev
251 100+
Hi,
Sorry about my previous post.
I have been using some third party tools since I plunged into windows apps.
and they have beautiful support for filtering.

Coming back to your query, in your case you might be using a dataView to change the filter.

once the filter is changed, I think the ListChanged Event of the dataview is triggered.

Once you reach here you can check if the row isvisible as mentioned before.

cheers
hello, actually i already did the code as suggested. what bothers me is that when time comes there are a lot of firstname records, my iterating for loop might take time to process them. is there a way to create a relationship to dtt1 and dtt2 so that dtt2 gets filtered when i filter dtt1? how do you do code to create a relation?
Nov 21 '07 #6
Shashi Sadasivan
1,435 Expert 1GB
i think the filter should be of type
FirstName OR firstname2 OR firstname3.....
and not
FirstName AND firstname2 AND firstname3.....

with the AND you may get no items listed.

Seems that the filter you reate will be the same filter for the second table too.
So build a filter string, and assign that to both the datatables!

if you filter table 1 with names fred and jones
then you want table 2 to contain values with names fred and jones.
so the same string should apply.

Hope i got it right
Nov 21 '07 #7
nev
251 100+
oh i forgot to mention i used OR :-)
Nov 21 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Nick | last post by:
Is it possible to have multiple auto increments in one column? Say I have two tables... 1. table 'messageboards' with fields ('id' , 'name') 2. table 'messagethreads' with fields ('id' ,...
1
by: Robert Neville | last post by:
I would like to add filter functionality to my database whether through the Main form or the subform. This question may be rudimentary, yet I have not less experience with filtering data outside...
3
by: Richard | last post by:
Hi, I have a form based on a table. When I filter the form I want to run a report based on the same table with the same filter as the form. No problem until I want to filter a combo box where...
20
by: Steve Jorgensen | last post by:
Hi all, I've just finished almost all of what has turned out to be a real bear of a project. It has to import data from a monthly spreadsheet export from another program, and convert that into...
1
by: Keith | last post by:
A2003, Xp Pro. I've designed a form which contains 6 of combos. Three on the left are set up to select fields from a query, three on the right are set up to select values from the corresponding...
3
by: MrNobody | last post by:
I've read that the expression property for DataColumns is used to "Sets or retrieves the expresssion used to filter rows, calculate the values in a column, or create an aggregate column.". I...
4
by: Fran | last post by:
I recently tried to use code for "Use a multi-select list box to filter a report" from Allen Browne in my database. I was able to add the code and adapt it to my needs, however I am getting an...
2
by: PaulR | last post by:
Hi, (DB2 LUW v8.2) When using parameter markers how does the optimizer evaluate filter factors? - and is it able to make use of distribution stats. for parm. markers? The reason I ask, is...
5
aas4mis
by: aas4mis | last post by:
I haven't had much luck with specific controls, their properties and loops in the past. I thought I would share this tidbit of code, feel free to modify/modularize in any way to suit your needs. This...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.