View Full Version : UPDATING A FIELD


Janet Seber
02-01-2005, 06:29 AM
Could someone please direct me on how to update a specific field. I am dealing with records with a field set up for the age of our employees. When an employee has a birthday, is there a way to automatically update the field without having to do it manually?
I have tried going to Operations and doing a numeric update of the field by adding the number one to the field....but it updates all the records from January -December for the whole year, making everyone a year older before their birthdate has arrived.
Thanks for any assistance anyone has to offer.


Tom Cone Jr
02-01-2005, 06:38 AM
Janet, my advice would be don't do it.

Just store the birth date in the table. You can calculate the current age using the age() function anytime you need it later on, in forms or in reports.

-- t

02-01-2005, 06:42 AM

If you have one field with date of birth and another with age (age being a calculated value), you can create and operation to update the age when the form is opened. Open Help, type 'form events' and scroll down the results and you will see a section on various form events, what they do and when they do it. It look like you want the OnInit event, which occurs when the form is loaded.


Stan Mathews
02-01-2005, 06:56 AM
" have tried going to Operations and doing a numeric update of the field by adding the number one to the field....but it updates all the records " - most saved operations accept filters. There is often a "Select Records" button in the toolbar of the operation design genie which will lead to the dialog where you can specify a filter to limit the scope of the operation.

For example, the filter could include an ask variable which prompted you for which "id" to update.

That said the other advice you received is probably a better way to go.

Janet Seber
02-02-2005, 04:37 AM
Hi Tom,

I have been working with Alpha 5 v5 for 2.5 years now. I had to teach myself from scratch. The manual to me, is not that self explanatory. I not quite sure how to create a function within a table and how to use it. Could you spare me a few more details? Thanks for providing me with the info to my previous question.


Tom Cone Jr
02-02-2005, 04:54 AM

Alpha Five includes a whole host of predefined functions that do all sorts of useful things for you. If you check the docs for information on the AGE() function you'll see an example of how the function works. There's no need to re-program the function, as you seem to think. You just use it.

For example:

Let's say you have a C type field in your table called "F_name". Let's say you've stored "Janet" there. If
you wanted to display this field value in a report or on a form, you'd just drag and drop the field there, right? But what if you want to display the f_name using all capital letters? It's not necessary to go back to the table and store "JANET" in the f_name field. Instead, in the form or report, you create a new calculated field and use the predefined "UPPER()" function, like this:


Then you drag and drop the new calc field on to the layout and you'll see "JANET" even though the table still has "Janet" in the F_name field.

See how this works?

Now, current age works the same sort of way. Let's say you have a D type field in your table called "B_date", and let's say that you store the date {09/13/1948} there. When you want to display the current age in a form or report, just define a new calculated field in the layout and use this simple expression:


Drag and drop the calc field into your layout and when the form or report is displayed you'll see that the AGE() function took the birth date field value and converted it to an age (expressed in years).

You can test expressions like these in the interactive editor:

dim f_name as C
f_name = "Janet"
New_name = UPPER(f_name)

dim b_date as D
b_date = {09/13/1948}
Curr_Age = age(b_date)
= 56

If this sort of thing is of interest to you I recommend you sign up for one of the PACE training sessions.

-- tom