Suppose I have two attributes for the polygons on one layer representing buildings: one is number of floors and the other is building height, the latter equals to "number of floors" times 3 meters.

Is there a way to automatically update building height value if the number of floors is changed?

2 Answers 2


I don't think you can link two existing attributes together, but you can create a virtual field with the field calculator.

The values of a virtual field are automatically updated, but keep in mind that a virtual field will not be saved with its layer: it can only be saved within a QGIS project.


If I understand your question correctly, the AutoFields plugin should do the job for you. It "...allows you to configure vector fields to be automatically calculated for you when digitizing new features or modifying existing ones." Watch these videos for some demonstrations.

In your case, you would need to configure the existing Height field (i.e., you don't need to create an additional field) as an AutoField with this expression:

"floors" * 3

Doing so, every time you change the building floors attribute, the corresponding height will be updated.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.