473,765 Members | 2,019 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need to "normalize" table

I currently have a spreadsheet tracking votes on legislation in a matrix
type
format. It is something like this

Name Act1 Veto1 Act1A
Jones yes No Yes
Johnson Yes Yes Ex.

Only with many more members and bills. I want to normalize this so
that i can create reports by both Bill and by member - linking it to tables
with bill descriptions and member profiles. I think what I want is a table
like this:

Name Act Vote
Jones Act1 Yes
Jones Veto1 No
Johnson Act1 Yes

I need help writing a function or a query that can do that.
Jan 24 '06 #1
4 1928
Nathan Benefield wrote:
I currently have a spreadsheet tracking votes on legislation in a matrix
type
format. It is something like this

Name Act1 Veto1 Act1A
Jones yes No Yes
Johnson Yes Yes Ex.

Only with many more members and bills. I want to normalize this so
that i can create reports by both Bill and by member - linking it to tables
with bill descriptions and member profiles. I think what I want is a table
like this:

Name Act Vote
Jones Act1 Yes
Jones Veto1 No
Johnson Act1 Yes

I need help writing a function or a query that can do that.


What's an Act, an Action (what type of action), the member is a
Actor...? Is the Vote on the Veto a vote to veto the bill ?? Wouldn't
that be a yea or nay vote on the bill itself?
--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)
Jan 24 '06 #2
An Act is and Act - passed and signed by the governor. The Vote on the Veto
is a vote to pass a bill which was passed and then vetoed.

"MGFoster" <me@privacy.com > wrote in message
news:1w******** ********@newsre ad1.news.pas.ea rthlink.net...
Nathan Benefield wrote:
I currently have a spreadsheet tracking votes on legislation in a matrix
type
format. It is something like this

Name Act1 Veto1 Act1A
Jones yes No Yes
Johnson Yes Yes Ex.

Only with many more members and bills. I want to normalize this so
that i can create reports by both Bill and by member - linking it to
tables
with bill descriptions and member profiles. I think what I want is a
table
like this:

Name Act Vote
Jones Act1 Yes
Jones Veto1 No
Johnson Act1 Yes

I need help writing a function or a query that can do that.


What's an Act, an Action (what type of action), the member is a Actor...?
Is the Vote on the Veto a vote to veto the bill ?? Wouldn't that be a yea
or nay vote on the bill itself?
--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)

Jan 25 '06 #3
GH
Nathan,

Wouldn't it make more sense to have three tables, one to store the
members, one for the acts, and a join showing the member's vote?

It would look like:

MEMBER table
MemberID MemberName etc.
1 Jones
2 Johnson
etc.

ACT tables
ActID ActTitle etc.
1 Act1
2 Act1A
etc.

VoteTable
MemberID ActID VoteBit
1 1 Y
1 2 Y
2 1 N
etc.

(or something along these lines)

Anyway, I had to do something similar a while back where the table had
columns that really should have been rows in a different table. I
wrote a function that looped through the columns of the table and
looked for key naming structures then populated the new table with the
appropriate values. Of course, this assumes that the columns to be
normalized follow a structured naming convention that can easily be
converted to field values. Unfortunately, I cannot share the specific
function, as it is not available to me now, but the general concept is
to use the FOR EACH loop to loop through the columns of the table or
select the table schema from an ADO recordset.

Dim fld As Field
For Each fld In CurrentDB.Table Defs("YourTable ").Fields
If [fld.Name condition to determine which columns to process]
Then
[Build and process a SQL string to update the data to
the new table structure]
End If
Next fld

OR

Dim rs As New ADODB.Recordset

Set rs= [YourADOConnecti on].OpenSchema(adS chemaColumns, Array(Empty,
Empty,
"YourTableName" ))
While Not rs.EOF
If [rs!COLUMN_NAME condition to determine which columns
to process] Then
[Build and process a SQL string to update the data
to the new table structure]
End If
rs.MoveNext
Wend
rs.Close

I still had to customize my function due to irregularities in some
column names, but the names generally followed a pattern that could be
used within a CASE construct or IF statement to convert to field
values.

I hope this helps you.

- GH

Nathan Benefield wrote:
An Act is and Act - passed and signed by the governor. The Vote on the Veto
is a vote to pass a bill which was passed and then vetoed.

"MGFoster" <me@privacy.com > wrote in message
news:1w******** ********@newsre ad1.news.pas.ea rthlink.net...
Nathan Benefield wrote:
I currently have a spreadsheet tracking votes on legislation in a matrix
type
format. It is something like this

Name Act1 Veto1 Act1A
Jones yes No Yes
Johnson Yes Yes Ex.

Only with many more members and bills. I want to normalize this so
that i can create reports by both Bill and by member - linking it to
tables
with bill descriptions and member profiles. I think what I want is a
table
like this:

Name Act Vote
Jones Act1 Yes
Jones Veto1 No
Johnson Act1 Yes

I need help writing a function or a query that can do that.


What's an Act, an Action (what type of action), the member is a Actor...?
Is the Vote on the Veto a vote to veto the bill ?? Wouldn't that be a yea
or nay vote on the bill itself?
--
MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
Oakland, CA (USA)


Jan 25 '06 #4
I have three tables, the first two - with member information and with Act
descriptions are done. My problem is with creating the third table in the
format needed. I have played around with the first function a bit, but
need less ambiguity, as my programming knowledge is limited. The table I am
starting from is called "house votes" with fields "Name" for legislator name
and fields for each act "Act 1" , "Act 98", "act 1A", "Veto 1", etc.

I have tried this, but get errors right away.

Function Field()
Dim fld As Field
For Each fld In CurrentDb.Table Defs("House Votes").Fields
If [fld.Name Not="Name"] Then
[SELECT fld.Name as "Act Number", Name As "Name", fld as
"Fld" INTO "Votes" ]
End If
Next fld
End Function
"GH" <bo************ **@gmail.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
Nathan,

Wouldn't it make more sense to have three tables, one to store the
members, one for the acts, and a join showing the member's vote?

It would look like:

MEMBER table
MemberID MemberName etc.
1 Jones
2 Johnson
etc.

ACT tables
ActID ActTitle etc.
1 Act1
2 Act1A
etc.

VoteTable
MemberID ActID VoteBit
1 1 Y
1 2 Y
2 1 N
etc.

(or something along these lines)

Anyway, I had to do something similar a while back where the table had
columns that really should have been rows in a different table. I
wrote a function that looped through the columns of the table and
looked for key naming structures then populated the new table with the
appropriate values. Of course, this assumes that the columns to be
normalized follow a structured naming convention that can easily be
converted to field values. Unfortunately, I cannot share the specific
function, as it is not available to me now, but the general concept is
to use the FOR EACH loop to loop through the columns of the table or
select the table schema from an ADO recordset.

Dim fld As Field
For Each fld In CurrentDB.Table Defs("YourTable ").Fields
If [fld.Name condition to determine which columns to process]
Then
[Build and process a SQL string to update the data to
the new table structure]
End If
Next fld

OR

Dim rs As New ADODB.Recordset

Set rs= [YourADOConnecti on].OpenSchema(adS chemaColumns, Array(Empty,
Empty,
"YourTableName" ))
While Not rs.EOF
If [rs!COLUMN_NAME condition to determine which columns
to process] Then
[Build and process a SQL string to update the data
to the new table structure]
End If
rs.MoveNext
Wend
rs.Close

I still had to customize my function due to irregularities in some
column names, but the names generally followed a pattern that could be
used within a CASE construct or IF statement to convert to field
values.

I hope this helps you.

- GH

Nathan Benefield wrote:
An Act is and Act - passed and signed by the governor. The Vote on the
Veto
is a vote to pass a bill which was passed and then vetoed.

"MGFoster" <me@privacy.com > wrote in message
news:1w******** ********@newsre ad1.news.pas.ea rthlink.net...
> Nathan Benefield wrote:
>> I currently have a spreadsheet tracking votes on legislation in a
>> matrix
>> type
>> format. It is something like this
>>
>> Name Act1 Veto1 Act1A
>> Jones yes No Yes
>> Johnson Yes Yes Ex.
>>
>> Only with many more members and bills. I want to normalize this so
>> that i can create reports by both Bill and by member - linking it to
>> tables
>> with bill descriptions and member profiles. I think what I want is a
>> table
>> like this:
>>
>> Name Act Vote
>> Jones Act1 Yes
>> Jones Veto1 No
>> Johnson Act1 Yes
>>
>> I need help writing a function or a query that can do that.
>
> What's an Act, an Action (what type of action), the member is a
> Actor...?
> Is the Vote on the Veto a vote to veto the bill ?? Wouldn't that be a
> yea
> or nay vote on the bill itself?
> --
> MGFoster:::mgf0 0 <at> earthlink <decimal-point> net
> Oakland, CA (USA)

Jan 25 '06 #5

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

Similar topics

1
6027
by: Daniel Lim | last post by:
When using XmlSerializer, I notice that it does not normalize the single quote and double quote characters, i.e. does not change ' to &apos; and " to &quot. However, it does normalize other characters, like changing ampersand to &amp; Here is my code: ---- start of code -------- MyClass *myClass = MyClass() ; XmlSerializer *xs = new XmlSerializer( __typeof( MyClass ) ) ;
7
2755
by: Philip Nelson | last post by:
Folks, I've been exercising my mind recently about the complexities of implementing a "currency" data type within DB2 to cope with multiple currencies. A monetary value is often simply represented as a DECIMAL column : for example many times I've seen DECIMAL(12,2) used. The issue with this is that there is nothing to interpret what currency this relates to (US dollars, Canadian dollars, Euros, British pounds or whatever), and a...
8
2583
by: Rob Mazur | last post by:
Hi. I'm trying to create a query that pulls information from 3 seperate tables. Here's how I want it to work: User is prompted for SSN Table 1: SSN Name Gender
5
1931
by: Colleyville Alan | last post by:
I need to import a spreadsheet into an Access table. The spreadsheet has performance for mutual funds for various periods. The problem is that if there is no info for a particular period, the spreadsheet contains a dash in the cell (for example if the fun is only 4 years old and I look in the columns for 5-year and 10-year performance). I cannot change the dashes to blank with a global change, the negative numbers would lose the...
4
1650
by: lorirobn | last post by:
Hello, I'd be curious to hear other thoughts on my database and table design. My database is for 'space use' in a lodging facility - will hold all spaces, like rooms (lodging rooms, dining areas, public areas), grounds, bathrooms, hallways, etc. User would like to keep track of all spaces as well as items in them, and the condition of items (ie: beds, so he can budget when it's time to replace them). He does not want to track...
1
2040
by: arnold | last post by:
Hi, I've been knocking my head against the wall trying to create an XSL transform to perform "normalizations" of a set of XML files that have a common structure. % XML file before transform
6
2314
by: AndyL | last post by:
Hi, I have a lot of sources with mixed indentation typically 2 or 4 or 8 spaces. Is there any way to automatically convert them in let's say 4 spaces? Thx, A.
3
1471
by: Macbane | last post by:
Hello All, This has been bugging me for too long. I have a database that records medical interventions. I am familiar with the theory behind normalisation but am unsure what to do with the following data. Firstly, I have a main table which records the specifics of the intervention (date, reporter, details, location etc). It has links and the database is normalised ok as far as I can make out. However, I have 6 check box fields in...
9
4285
by: Peter Bengtsson | last post by:
In UTF8, \u0141 is a capital L with a little dash through it as can be seen in this image: http://static.peterbe.com/lukasz.png I tried this: '' I was hoping it would convert it it 'L' because that's what it visually looks like. And I've seen it becoming a normal ascii L before in other programs such as Thunderbird.
0
9568
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
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
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...
1
9959
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
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
8833
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...
0
6649
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5277
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2806
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.