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

Denis Rouzaud denis.rouzaud at gmail.com
Tue Jun 4 07:57:23 PDT 2013


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130604/b5073a0c/attachment.html>


More information about the Qgis-developer mailing list