[Qgis-user] use autogenerated form in Qgis for same table in different postgres databases

Bernhard Ströbl bernhard.stroebl at jena.de
Mon Dec 22 01:12:27 PST 2014


Hi Janneke,

I published a new version of the plugin which includes the fix I 
mentionend. Please check it out and call back if the problem is still 
arising.

Bernhard

Am 22.12.2014 09:09, schrieb Janneke van Dijk:
> Hello Bernhard,
>
> Thanks for the suggestion. I just installed the plugin. When selecting a
> table and trying to initialise the layer I get a Database Error: syntax
> error at or near "("
> LINE1: EXECUTE ('public'.'T_network_geometry') (followed by more, I can
> send the screenshot).
>
> When I click OK the python error window shows:
>
> Traceback (most recent call last):
>    File
> "C:/Users/Janneke/.qgis2/python/plugins\DataDrivenInputMask\datadriveninputmask.py",
> line 188, in initializeLayer
>      inputUi = None,  searchUi = None,  helpText = "") # set the
> defaults here because somehow some of the values persist
>    File
> "C:/Users/Janneke/.qgis2/python/plugins\DataDrivenInputMask\ddmanager.py",
> line 176, in initLayer
>      readConfigTables = readConfigTables)
>    File
> "C:/Users/Janneke/.qgis2/python/plugins\DataDrivenInputMask\ddui.py",
> line 371, in createUi
>      showParents,  showChildren,  readConfigTables, createAction)
>    File
> "C:/Users/Janneke/.qgis2/python/plugins\DataDrivenInputMask\ddui.py",
> line 200, in __createForms
>      n2mAttributes = self.getN2mAttributes(db,  thisTable, anAtt.name,
> anAtt.num,  labels,  showChildren,  skip)
>    File
> "C:/Users/Janneke/.qgis2/python/plugins\DataDrivenInputMask\ddui.py",
> line 635, in getN2mAttributes
>      configList =  self.configureLayer(ddRelationTable,  [], {},  [],
> {},  {},  [],  db,  True,  "")
>    File
> "C:/Users/Janneke/.qgis2/python/plugins\DataDrivenInputMask\ddui.py",
> line 184, in configureLayer
>      DbError(query)
>    File
> "C:/Users/Janneke/.qgis2/python/plugins\DataDrivenInputMask\dderror.py",
> line 54, in __init__
>      raise FatalError("DBError exiting")
> FatalError: 'DBError exiting'
>
>
> Python version:
> 2.7.4 (default, Apr  6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]
>
> QGIS version:
> 2.6.1-Brighton Brighton, e2a51df
>
>
> Should I do something else before initialising the layer?
>
> thanks,
> Janneke
>
>
> On 22/12/2014 10:14, Bernhard Ströbl wrote:
>> Hi Janneke,
>>
>> this is not answering your question... but, have you tried the
>> DataDrivenInputMask plugin [1]. It auto-generates input masks for
>> PostgreSQL layers. Only prerequisite is a properly designed database
>> in respect to constraints, default values, data types.
>>
>> regards
>>
>> Bernhard
>>
>> [1] http://plugins.qgis.org/plugins/DataDrivenInputMask/
>>
>> Am 21.12.2014 15:44, schrieb Janneke van Dijk:
>>> Dear all,
>>>
>>> I have set up a form in QGIS 2.6 using the attribute editor layout
>>> 'autogenerate', to edit an editable view in a postgres database. This
>>> works nicely. I would like to use this form to edit data in other
>>> databases that have an identical structure. Ideally, I would set up a
>>> project file with all properties set where I could choose to load layers
>>> either from one or another database (with identical structures), and
>>> when I edit a layer the correct form opens.
>>>
>>> If I save it as a .qml file (from project1 connected to database1), then
>>> load it in project2 (connected to database2 with identical tables
>>> loaded) through properties>fields>load style it appears to load it (the
>>> edit widgets get changed to the same as in project1), but when I click a
>>> value relation widget the layer, key column and value column fields are
>>> empty. When I open the attribute table all fields that have a value
>>> relation that refers to a lookup table that contains different values
>>> than the original lookup table will show their values between brackets
>>> (at least, those values that do not appear in the original table).
>>>
>>> It looks as if the .qml retains a link to the original database and
>>> lookup tables (and not just to layer names as they are loaded in the
>>> project). Is there a way to configure a form based on a table structure
>>> that can be re-used for other tables with the same structure?
>>>
>>> Thanks,
>>>
>>> Janneke
>>>
>>>


__________ Information from ESET Mail Security, version of virus signature database 10912 (20141221) __________

The message was checked by ESET Mail Security.
http://www.eset.com





More information about the Qgis-user mailing list