[Qgis-developer] Open a form of a linked table

Andreas Neumann a.neumann at carto.net
Tue Jun 4 08:06:03 PDT 2013


Hi Denis,

Thanks - this should help me to implement it.

Andreas

Am 04.06.2013 16:57, schrieb Denis Rouzaud:
> Hi ,
> 
> I did not test, but adding a python action to the layer B should work:
> 
> layerA = QgsMapLayerRegistry.instance().mapLayer("layerAid")
> 
> featureAid = [% "layerAid_column_name" %]
> 
> f = QgsFeature()
> 
> layerA.getFeatures(QgsFeatureRequest().setFilterFid(featureAid)).nextFeature(f)
> 
> 
> iface.openFeatureForm(layerA, f)
> 
> 
> If the layerA has no geometry, you might need to add NoGeometry as a
> flag to the feature request.
> 
> Also, you might need to test if f is found.
> 
> Cheers,
> 
> Denis
> 
> 
> 
> On 06/04/2013 04:44 PM, Andreas Neumann wrote:
>> Hi,
>>
>> I have two tables with a 1:n to relation from table A to B.
>>
>> In the form of table "B" I want to display a button that opens the
>> corresponding record in a form of table A (in a separate window).
>>
>> I know that Matthias Kuhn is working on such functionality for QGIS 2.1
>> - but I would need a script-based solution now - this project cannot
>> wait for QGIS 2.1
>>
>> Does someone have a python script that does something like that or
>> similar things?
>>
>> The idea is to have a Python action with a few lines of code that does
>> this and can be associated to a button.
>>
>> Thanks,
>> Andreas
>> _______________________________________________
>> Qgis-developer mailing list
>> Qgis-developer at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> 
> 



More information about the Qgis-developer mailing list