[GIS] Possible to set an attribute field to update automatically based on another field

attribute-tabledynamicfields-attributesqgisupdate

If I have 2 attribute columns and I wish to change certain values, is it possible for the second attribute column to automatically update its values based on an expression?

Example:

Age |  Status
10  |  Child
14  |  Child

If I change the Age from 14 to 18, I would like the Status to automatically change from Child to Adult, so it would look like the following:

Age |  Status
10  |  Child
18  |  Adult

I must only be able to do this within QGIS and without the use of database functionalities such as PostGIS/SpatiaLite etc. I've looked at Value relations but that only seems to provide drop-down box for the user to select the relating columns. I've also looked at Relation Reference but it won't allow me to select a "Relation" (not even sure what Relation Reference actually does).

Please advise?

I am using QGIS 2.2.

Best Answer

What you want is available starting from QGIS 2.6 and is called Virtual Field. Just create a new attribute, select "Virtual Field" and insert the expression used to calculate the new column.

For your case:

CASE WHEN "Age" < 18 THEN 'Child' ELSE 'Adult' END 

You can use a recent nightly build / test build to use this new feature.

The value relation and relation reference widgets are used to show attributes from a first table (layer) on a second table.