<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hi ,<br>
<br>
I did not test, but adding a python action to the layer B should
work:<br>
<br>
<meta name="qrichtext" content="1">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><!--StartFragment-->layerA
= QgsMapLayerRegistry.instance().mapLayer("layerAid")</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;">featureAid
= [% "layerAid_column_name" %]</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;">f =
QgsFeature()</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;">layerA.getFeatures(QgsFeatureRequest().setFilterFid(featureAid)).nextFeature(f)</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;">iface.openFeatureForm(layerA,
f)<br>
</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br>
If the layerA has no geometry, you might need to add NoGeometry as
a flag to the feature request.<br>
</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;">Also, you
might need to test if f is found.<br>
<br>
</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;">Cheers,<br>
</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;">Denis<br>
</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br>
<!--EndFragment--></p>
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style><br>
<div class="moz-cite-prefix">On 06/04/2013 04:44 PM, Andreas Neumann
wrote:<br>
</div>
<blockquote cite="mid:51ADFD4A.6060709@carto.net" type="cite">
<pre wrap="">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
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
</pre>
</blockquote>
<br>
</body>
</html>