<div dir="ltr"><div>Martin,<br><br>Thanks for your answer. Indeed I did not add the layer to the registry in my foreach loop. I did it at the end (for better performance )<br>Now it is working, thanks a lot !<br><br></div>
Michael<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-06-19 6:54 GMT+02:00 Martin Dobias <span dir="ltr"><<a href="mailto:wonder.sk@gmail.com" target="_blank">wonder.sk@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Michael<br>
<br>
your code works for me. Maybe you have not added the loaded DBF to the<br>
QgsMapLayerRegistry before using it for the join? The main layer<br>
otherwise does not have a way to resolve the reference to layer from<br>
its ID.<br>
<br>
By the way, it is not necessary to set "joinFieldIndex" and<br>
"targetFieldIndex" members - they will have no effect.<br>
<br>
Regards<br>
Martin<br>
<div><div class="h5"><br>
<br>
On Thu, Jun 19, 2014 at 12:22 AM, kimaidou <<a href="mailto:kimaidou@gmail.com">kimaidou@gmail.com</a>> wrote:<br>
> Hi all.<br>
><br>
> I am trying to join a DBF to a vector layer via python . I can create the<br>
> QgsVectorJoinInfo() , set the parameters and add it to the layer :<br>
> <a href="https://pastee.org/fv55y" target="_blank">https://pastee.org/fv55y</a><br>
><br>
> When I get vlayer.vectorJoins() , it is filled (3 times, because I made 3<br>
> attempts), but when I open the vector layer properties dialog, no join<br>
> appears in the Join tab.<br>
><br>
> Should I update something after adding the join via addJoin method ? Has<br>
> anyone a working example ?<br>
><br>
> Thanks in advance<br>
><br>
> Michael<br>
><br>
</div></div>> _______________________________________________<br>
> Qgis-developer mailing list<br>
> <a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</blockquote></div><br></div>