Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create a calculated field
Message
From
01/10/2002 14:02:28
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
01/10/2002 13:51:28
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00706493
Message ID:
00706499
Views:
20
>I would like to create a calculated field that is based on 2 other fields in a table. The table is included in a database.
>
>For example.
>I have 2 fields lets say numerics with data in them.
>
>I add a third field to my table.
>
>Everytime someone updates one of the first 2 fields i'd like the third field to change also.
>
>for simplicity lets say Field1 x Field2 = Field3
>
>3 x 2 = 6
>
>Whats the best way to do this, would I utilize the update trigger and a stored procedure?

The best is not to include calculated fields, when the results can be obtained by simple calculations from other fields in the same record. Saving the calculated field separately is simply a waste of space.

Just calculate the product on-demand - for instance, you can set the .ControlSource of a Grid.Column to the desired product.

If you need many, or complicated, calculations (based on the same record), you might consider having a funcion or class that you invoke to "fetch" all required "calculated fields" for the current record.

HTH, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform