2

My PostgreSQL database has ElectricLine geometry table which has one-to-many relationship with ElectricLineMaterial non-geometry (attribute only) table. This PostgreSQL table added as layer in QGIS 2.0.1. When the user add/edit an ElectricLine, he should have ability to add one or more ElectricLineMaterial records against to that geometry.

Can I achieve this requirement via Custom QGIS Forms? In other words, I want to have an "Add Electric Line Material" button in the form to add many materials against the current adding/editing electric-line.

Note: I am new to QGIS and learning QT Designer.

2

Rather than build a solution yourself, there is a plugin you can use. The Data Driven Input Mask plugin can handle data entry for one-to-many situations. It can also handle constraints, foreign key relationships, etc in your Postgres database.

  • I also tried it out, but I got the error "cannot import name QtSql". Anybody else have that problem? – tobias47n9e Jan 21 '14 at 19:08
  • I have installed the plugin to QGIS and added relationships between PostgreSql tables. But there are no changes in the UI. How to enable this plugin functionality in the UI? – Vasudevan Periasamy Jan 21 '14 at 20:32
1

QGIS 2.1's Relations handles the relationship data in QGIS in a excellent way.

Note: 2.1 is a dev version, 2.2 will be the release version.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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