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

Janneke van Dijk janneke.qgis at gmail.com
Mon Dec 22 11:48:31 PST 2014


Hi Bernhard,

with the new plugin I was able to configure a mask for a table (it 
doesn't work for a postgres view, even if the view is editable? Would 
that not be possible to adjust?), and initialise the layer, and open the 
dataform. I did have to enter the databasename and password several 
times in a row. I have not tried using it yet but it at least opens and 
it looks promising!

Things that I have working in the autogenerated form but don't see here 
(yet), I would like to know if it's already possible or if I would have 
to modify this using Python:

- Is it possible to have the comboboxes show the descriptions of the 
corresponding lookup table, in stead of the ids that will be stored in 
the table? (the autogenerated form worked on the view that already 
provided the descriptions)
- Do I understand it correctly that it can only be used for editing 
existing data, not for adding new records?

I'll look at it in more detail tomorrow, see if this can do what I would 
need it to do.

Thanks!
Janneke

On 22/12/2014 12:12, Bernhard Ströbl wrote:
> 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
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>




More information about the Qgis-user mailing list