473,657 Members | 2,283 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 2035
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.websitebu ro.oops.comwrot e:
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.websitebu ro.oops.comwrot e:
>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.websitebu ro.oops.comwrot e:
kou...@hotmail. com a écrit :
On Sep 20, 10:34 am, Bruno Desthuilliers <bruno.
42.desthuilli.. .@wtf.websitebu ro.oops.comwrot e:
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
2286
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 with botanical name, common name, size, and price.) Based on their choice, I would like the other 3 fields filled in from the lookup table. The resulting date should be written to the base table which will be a record of the plants ordered,...
1
3353
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 table B which links to A via a Lookup Field so that I can select the friendly name from combo box. Now, I want to have a table C which links to table B via a lookup field, and only displays the items which are selected in some combo box of some...
3
10639
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 that are hard to find. The main problem I am having right now is that I have a report that is sorted by one of these lookup fields and it only displays the record's ID number. When I add the source table to the query it makes several records...
1
2132
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 text in a specified field. The table of data that is looked up has 3 fields: Index , Eng , Fr . When I concatenate the fields into the expression, the field for looking up the month displays as the numeric value of the lookup table, not the...
4
4611
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 bound to a table as a lookup, drawing values from another table to populate the available selections. This all worked fine in VB6. I have distilled the problem down to a simple form drawing data from the Northwind database for a representative...
0
1985
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 values of prefixes from the Prefix table based on the PrefixID in the Prefix table. When I load a windows application form, I can display and update data from the primary table. This includes the prefixID value. If I display a combo box with...
3
3546
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 source for my form tblExpenses. In this table there are three relevant fields . On the form the field is set up as a combobox to get
11
2645
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 tblPeople called PreferredPet. 2. A lookup field that stores text values. Create a text field in tblPeople called PreferredPetID and use it to lookup an identical text field in tblPreferredPets.
2
3643
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 LookupTable.Description OtherDataTable
2
964
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 based on the code. Regards
0
8411
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8838
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8613
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7351
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2740
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 we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.