Use a related table, with fields for weight and dateOfMeasurement.
Then sort the relationship by dateOfMeasurement, and your calculation is simply
BabyWeight::weight - Last ( BabyWeight::weight )
or reverse, depending on the actual sort order used.
hm i'm not sure i understand (sorry - i am new to filemaker). let me more fully explain exactly what i want to do and then maybe you could elaborate?
we want to have multiple fields for baby's weight (all input on the same day, over the course of a nursing session). for example:
6 lb 2.4 oz - Weight1
6 lb 3.1 oz - Weight2
6 lb 4.2 oz - Weight3
1.8 oz - Milk Transferred
it would be ideal if we could also have all weights auto-calculated into kilograms (to be displayed next to the pounds/ounces.
thanks for your help!
You need a separate table for all weights.
Suppose we have a table called BabyInfo, where you have all your patients. Then you will relate that table to another table called Weights. You can name its table occurrence as BabyInfo_Weights for example.
Then, from the BabyInfo table you'll create a calculated field called WeightDelta for example. The calculation of this field would be:
WeightDelta = Max ( BabyInfo_Weights::TheWeight ) - Min ( BabyInfo_Weights::TheWeight )
I'm using Max () and Min () because in your statement I'm assuming that all weights will not necessarily be correctly entered (in chronological order) but in any order. Using Last () will only work if all data is entered in chronological order.
Ibrahim has described in more details what I suggested in my first post.
Using a related table is much more flexible, and allows you to easily record any number of measurements, rather than just a fixed number (number of fields in the main table).
Adding to his post, you would have to enter a date field, since you want to analyze the measurements during a nursing session …
Come to think of it, maybe you should have …
Wetnurse --< FeedingSession >-- Baby
then relate the data table (measurement#, weight) to the FeedingSession table. The milkTransferred value is a single datum that pertains to the entire session, so that is where you would store it.
That probably looks & sounds kind of complicated, but really isn't … ;-)
btw, how do you enter the weight in empirical units? In a text field as "6lb 2.4oz", or do you have separate fields for pounds and ounces? The latter would be better to calculate the kg weight …
okay thanks! i was planning on having separate fields for pounds and ounces. i'm going to try out what you both have suggested. thanks again!