I want to create a point layer. In the attribute table I want to have two columns. In the first column I want to type an abbreviation like A. Then I want the second column to be auto filled with Arthur. How can I do that? I am working with QGIS 1.8. on a Mac 10.6
-
Where would the autofill words come from? I smell a database trigger looming in your future ;-).– MichaMay 20, 2014 at 8:21
-
Hi Micha, either I would type in the word at the first time and later it will be auto filled, or I would make an extra table (like in a database for a 1 to n join).– stefanMay 20, 2014 at 8:51
2 Answers
You can create a csv file with the abbreviation and the full text in two columns.
Then import that file as a Vector layer (which sound not logical), and you get a non-spatial layer.
After creating all points, you can join your point layer to the abbreviation csv layer to get the full-name column.
If you want real-time autofill, you might think of a self-made input form which reads your abbreviation and writes the full name into the database table.
Further reading on that:
How can I create a custom form to display the attributes of the selected object?
http://www.qgis.org/en/docs/training_manual/create_vector_data/forms.html
http://nathanw.net/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/
http://nathanw.net/2012/03/30/custom-qgis-feature-forms-value-binding/
http://osgeo-org.1560.x6.nabble.com/Open-custom-form-from-another-form-td5097972.html
-
Yes! I would prefer a real-time autofill. What is a self-made input? How do I do that?– stefanMay 20, 2014 at 9:12
-
1
-
Thank you very much!! Now I have learned how to build a form with QT Designer. But how can I make that it reads the abbreviation and writes the full name in the database?– stefanMay 20, 2014 at 13:10
-
The second blogpost from nathanw looks promising, I have not tested it myself.– AndreJMay 20, 2014 at 15:37
I found it easiest to simply edit the DBF file directly in Open Office Calc, for this type of task. Consider creating the empty (or partially filled) columns with correct datatypes first using QGIS. Then, you can open it up, edit and save with Calc. Be careful not to reorder the rows and don't touch the column headings.