Bug report #11893

QgsVectorJoinInfo in Windows doesn't work but works fine in Linux for 2.6.1

Added by Jeff Cavner about 10 years ago. Updated almost 10 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Vectors
Affected QGIS version:2.6.0 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:20107

Description

A programmatic join in 2.6.x using the following:

joinIdx = joinLyr.fieldNameIndex('siteid')
targetIdx = pamLyr.fieldNameIndex('siteid')
joinLyrId = joinLyr.id()
joinInfo = QgsVectorJoinInfo()
joinInfo.memoryCache = True
joinInfo.joinField = joinIdx
joinInfo.joinLayerId = joinLyrId
joinInfo.targetField = targetIdx
pamLyr.addJoin(joinInfo)

Works fine in Linux, but not in Windows. In windows if you look at the join in properties on the layer, the target field is missing. The fields from the joined layer show up in the attributes in the target layer but have no values.

History

#1 Updated by Martin Dobias almost 10 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed

In 2.x API in QgsVectorJoinInfo class there are no "joinField" and "targetField" members anymore. Use "joinFieldName" and "targetFieldName" and pass directly field names, i.e.:

joinInfo.joinFieldName = 'siteid'
joinInfo.targetFieldName = 'siteid'

Hope that helps.

Also available in: Atom PDF