Hi Michael your code works for me. Maybe you have not added the loaded DBF to the QgsMapLayerRegistry before using it for the join? The main layer otherwise does not have a way to resolve the reference to layer from its ID.
By the way, it is not necessary to set "joinFieldIndex" and "targetFieldIndex" members - they will have no effect. Regards Martin On Thu, Jun 19, 2014 at 12:22 AM, kimaidou <[email protected]> wrote: > Hi all. > > I am trying to join a DBF to a vector layer via python . I can create the > QgsVectorJoinInfo() , set the parameters and add it to the layer : > https://pastee.org/fv55y > > When I get vlayer.vectorJoins() , it is filled (3 times, because I made 3 > attempts), but when I open the vector layer properties dialog, no join > appears in the Join tab. > > Should I update something after adding the join via addJoin method ? Has > anyone a working example ? > > Thanks in advance > > Michael > > _______________________________________________ > Qgis-developer mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/qgis-developer _______________________________________________ Qgis-developer mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/qgis-developer
