View Full Version : Split Data


martien
12-01-2010, 07:17 AM
Hi,

I'm trying to buid a data base for my Dairy Herd. Once a month we gather data by yield recording.

A few conditions:

- The data is collect twice a day
- Each animal has a unique tag
- The two pieces of data gleaned, give a daily total, this number we use to rate, group and asses the animals and their performance
- The two recordings are very close in value, but we cannot assume they are the same
- I want to add the data separately, that is, I want to add the AM data in the morning, and then I want to add the PM data at night.

So my question is:

How can I use form(s) to put this data into one table, so that each animal will now have a AM and a PM yield associated with it.

Hopefully I have given enough information, if there are any questions please ask

Hopefully you can help me?

Thanks

Martien

boblarson
12-01-2010, 08:00 AM
Add a field to the table which is AMPM and then have a combo box with AM as one option and PM as another and then select which you want.

martien
12-01-2010, 08:32 AM
@BobLarson: So you are suggesting to add a combo box to the table, which will in turn show up on the form?

Essentially I want each Animal to have both pieces of data; AM & PM, its just that they would be added to the record at 2 different instances.

boblarson
12-01-2010, 08:49 AM
@BobLarson: So you are suggesting to add a combo box to the table, which will in turn show up on the form?
HEAVENS NO! That is putting a lookup at table level which is EVIL, EVIL I tell you. (see here for why)


Essentially I want each Animal to have both pieces of data; AM & PM, its just that they would be added to the record at 2 different instances.
You just add it to the FORM and then you select the time frame you want when you are entering the data. But you could do it entirely without that. Just include a date/time field and put the default (at table level) to be

Now()

and then when a record is created it will put in the date/time and then you can just use a query to get those before noon and those after noon.

gemma-the-husky
12-01-2010, 03:39 PM
if you have the following

tblCows - cowid, names/dob/etc etc

and another table

tblYields - cowid, date, litresam, litrespm

you can add a unique key so that you only get 1 record per cow, per day

now, if instead you structure it this way

tblyields - cowid, date, am_yesnoflag, litres

you can add a unique key consisting of the first 3 fields.

now, the benefit of the second method, is that you can easily sort ALL your readings, both am and pm - which is much harder to do the first way.


which is what Bob was suggesting. Technically, it is better not to have the lookups built in at table level. it might seem easier, but it obfuscates what is really going on.

just one other thing - you may need a disregard flag in the yields to allow for milk that has to be discarded because the cow is ill, or calving etc. not sure what you would do in those cases.

the data model will also get tricky if you want to try and store details of feed supplements etc given to certain cows, if you want to try and see the effect these have on yields. depends exactly what you want to do, or what is normal in the industry.