473,505 Members | 13,696 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Lookup values from one table to another based on a value

If I wanted to accomplish looking up values from one table based on a
value from another table or file, how would I go about doing this in
Python? Would I build a dictionary or an array?

exp:

Table1:

Site = 103
Lane = 2
Dir = ? # Get this from Table2

Table2:

Site, Lane, Direction,
103, 1, 1
103, 2, 1
103, 3, 5
103, 4, 5

Normally in Access I would just use a Dlookup and be done with it, or
use a Recordset in VB. Thanks guys.

Kou

Sep 20 '07 #1
5 2021
ko****@hotmail.com a écrit :
If I wanted to accomplish looking up values from one table based on a
value from another table or file, how would I go about doing this in
Python? Would I build a dictionary or an array?

exp:

Table1:

Site = 103
Lane = 2
Dir = ? # Get this from Table2

Table2:

Site, Lane, Direction,
103, 1, 1
103, 2, 1
103, 3, 5
103, 4, 5

Normally in Access I would just use a Dlookup and be done with it, or
use a Recordset in VB. Thanks guys.
What about using a database ? Like SQLite ?

Else, the canonical data structure for quick lookups is of course the dict.
Sep 20 '07 #2
On Sep 20, 10:34 am, Bruno Desthuilliers <bruno.
42.desthuilli...@wtf.websiteburo.oops.comwrote:
kou...@hotmail.com a écrit :


If I wanted to accomplish looking up values from one table based on a
value from another table or file, how would I go about doing this in
Python? Would I build a dictionary or an array?
exp:
Table1:
Site = 103
Lane = 2
Dir = ? # Get this from Table2
Table2:
Site, Lane, Direction,
103, 1, 1
103, 2, 1
103, 3, 5
103, 4, 5
Normally in Access I would just use a Dlookup and be done with it, or
use a Recordset in VB. Thanks guys.

What about using a database ? Like SQLite ?

Else, the canonical data structure for quick lookups is of course the dict.- Hide quoted text -

- Show quoted text -

Ah, yes, that would appear to be a better means to retrieve data. I
visited the site, which version should I download? Thanks.

Kou

Sep 20 '07 #3
ko****@hotmail.com a écrit :
On Sep 20, 10:34 am, Bruno Desthuilliers <bruno.
42.desthuilli...@wtf.websiteburo.oops.comwrote:
>kou...@hotmail.com a écrit :
(snip)
>>Normally in Access I would just use a Dlookup and be done with it, or
use a Recordset in VB. Thanks guys.
>What about using a database ? Like SQLite ?

Ah, yes, that would appear to be a better means to retrieve data. I
visited the site, which version should I download? Thanks.
The latest, unless you have reasons to choose an old one !-)

Sep 20 '07 #4
On Sep 20, 11:51 am, Bruno Desthuilliers <bruno.
42.desthuilli...@wtf.websiteburo.oops.comwrote:
kou...@hotmail.com a écrit :
On Sep 20, 10:34 am, Bruno Desthuilliers <bruno.
42.desthuilli...@wtf.websiteburo.oops.comwrote:
kou...@hotmail.com a écrit :
(snip)
>Normally in Access I would just use a Dlookup and be done with it, or
use a Recordset in VB. Thanks guys.
What about using a database ? Like SQLite ?
Ah, yes, that would appear to be a better means to retrieve data. I
visited the site, which version should I download? Thanks.

The latest, unless you have reasons to choose an old one !-)

If I flipped the Table being looked up not to repeat, would that make
things easier to look up a value in?

Exp:

Table1

Site = 103
Lane = 1
Direction = ?
FHWA Lane = ?

Table2

Site, Lane 1, Direction 1, FHWA Lane 1,
103, 1, 1, 1

Sep 20 '07 #5
ko****@hotmail.com a écrit :
(snip)
>
If I flipped the Table being looked up not to repeat, would that make
things easier to look up a value in?
Don't repeat informations.
Sep 20 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2271
by: Art at ABE Computer Consultants | last post by:
I'm missing something really simple, I'm sure. I have a form to be filled in. The operator choosed a plant species (the botanical name) from a list in a combo box. (The lookup table is populated...
1
3342
by: Zachary Turner | last post by:
I want to make a Lookup Field based on another Lookup field. In other words, I have this table A with two fields: ID and Name, where ID is an Autonumber and Name is a friendly name. Then I have a...
3
10605
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
1
2127
by: Dan | last post by:
I am using an expression in Forms to take several fields of data and convert them to a block of text. For one of the fields set-up as a combo box, it is based on a Lookup of a separate table to...
4
4602
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
0
1975
by: northshore | last post by:
Hello, I am creating a windows application database. I have a primary table 'Individuals' and a lookup table 'Prefixes.' In the Individuals table, I have a column 'PrefixID' that references...
3
3541
by: Jimmy | last post by:
I'm not sure the subject line is a very clear description of my problem so... I have two relevant tables for this issue... the lookup table tblLookupItems with three fields . The control...
11
2631
by: Paul H | last post by:
Suppose I have a table called tblPeople and I want a field to illustrate whether each person prefers cats or dogs. I could do it one of three ways. 1. A plain text field Create a text field in...
2
3639
by: =?Utf-8?B?VEQgaXMgUFNQ?= | last post by:
I have a lookup table with and ID field and a Description field, and another table that has its own ID field, the ID field from the lookup table, and other data. LookupTable LookupTable.ID...
2
958
by: axapta | last post by:
I'm returning values in my form from a table. However some of these values are based on lookups stored in another table. How can I retrieve the description of the values from the lookup table...
0
7213
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
7098
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
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7366
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...
1
7017
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
7471
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...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.