473,320 Members | 1,955 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,320 software developers and data experts.

Search a two-dimensional list or result set?

ck9663
2,878 Expert 2GB
Hi guys.

I have a two-dimensional list. I need to see if a value is existing on the third column of each row. Just like searching a table with the third column as the index key.

Do you read each row checking the specific column? Or is there a method or function that will do it.

The value of this list is coming from a result set. Rather than keep on querying the sql-server, I am implementing it as a two-dimensional list. It's a limitation, so i don't have much choice.

If there are no methods or function that will do the search on the list, then I have to read each row. Would it make sense then that I just read the search the result set, reading each row, than putting implementing this on a two-dimensional list?

Thoughts?

-- CK
Jun 3 '08 #1
3 2651
Laharl
849 Expert 512MB
Assuming you mean a 2D array, you'd be looping over matrix[i][2], I think. It would work similarly with la List, probably list.get(i).get(2). These snippets assume that I've got row/column down properly and that i is the loop counter.
Jun 3 '08 #2
ck9663
2,878 Expert 2GB
Yes, you're right.

By the way you mention it, that would mean I have to loop and read each row until list.get(i).get(2) = 'myvalue' where i is a counter from 1 to size of the list. Am I right?

If this is the case, would be better if I just read the result set?

-- CK
Jun 3 '08 #3
JosAH
11,448 Expert 8TB
Hi guys.

I have a two-dimensional list. I need to see if a value is existing on the third column of each row. Just like searching a table with the third column as the index key.

Do you read each row checking the specific column? Or is there a method or function that will do it.

The value of this list is coming from a result set. Rather than keep on querying the sql-server, I am implementing it as a two-dimensional list. It's a limitation, so i don't have much choice.

If there are no methods or function that will do the search on the list, then I have to read each row. Would it make sense then that I just read the search the result set, reading each row, than putting implementing this on a two-dimensional list?

Thoughts?

-- CK
Yes, IMHO it is a very bad choice to implement an entire row of a table as a list
that ends up in another list. Instead define a class that represents a row of a
table so you finally end up with a single list of class objects.

kind regards,

Jos
Jun 3 '08 #4

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

Similar topics

1
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast,...
39
by: Noticedtrends | last post by:
Can inference search-engines narrow-down the number of often irrelevant results, by using specific keywords; for the purpose of discerning emerging social & business trends? For example, if...
16
by: Stanley Sinclair | last post by:
Bear with me. I am being very calm; took a Valium. I have waited two weeks to write this, because every time I wrote it before the message was, at best, nasty. I need to use the services of...
1
by: TH | last post by:
I am (still :) working on a recipe database. Now I am trying to figure out how to set it up for an ingredient search. What I want it to be able to do is three things: 1. Search based on just...
2
by: TH | last post by:
I am (still :) working on a recipe database. Now I am trying to figure out how to set it up for an ingredient search. What I want it to be able to do is to search by one ingredient, sometimes by...
28
by: joshc | last post by:
If I have an array of data that I know to be sorted in increasing order, and the array is less than 50 elements, and I want to find the first element greater than a certain value, is a simple...
10
by: JohnR | last post by:
I have an arraylist of string values. I would like to search the arraylist to find the index of a particular string and I would like the search to be case insensitive. dim al as new arraylist...
1
by: Noticedtrends | last post by:
Hello, I'm seeking search-engine utilities that allow searches of content only contained in titles (as opposed to regular searches that search through all content)? The tools provided in...
5
by: JP SIngh | last post by:
Hi All This is a complicated one, not for the faint hearted :) :) :) Please help if you can how to achieve this search. We have a freetext search entry box to allow users to search the...
12
by: iahamed | last post by:
Hi Everyone, I got two parts of my advance search to work, I am running out of Logic to connect the third. My mind is in swing! Pleaseeeeeeeee Help me. I have 3 Fiels to search, the First two...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.