Skip to main content

how How to set and configure a value relation edittype in QGIS 2.0?

I am trying to set the edit type of a vector layer to use a value relation. The Python commands below are processed without errors or warnings, but the when I check the properties in QGIS, only the EditType is set, but the data settings are empty. I use:

vlayer.setEditType(12, QgsVectorLayer.ValueRelation)
vlayer.ValueRelationData( 'releatedtable20131027113855772', 'key', 'value',False, True)

I got the name of the related table by inspecting:

ml=QgsMapLayerRegistry.instance().mapLayers()
dict(ml)

My guess is that I use the wrong string for referencing the layername. I have two questions: How to get the layername string to be used in ValueRelationData? Should I add further code to get it all working?

Thanks, Harm Olthof

how to set and configure a value relation edittype in QGIS 2.0?

I am trying to set the edit type of a vector layer to use a value relation. The Python commands below are processed without errors or warnings, but the when I check the properties in QGIS, only the EditType is set, but the data settings are empty. I use:

vlayer.setEditType(12, QgsVectorLayer.ValueRelation)
vlayer.ValueRelationData( 'releatedtable20131027113855772', 'key', 'value',False, True)

I got the name of the related table by inspecting:

ml=QgsMapLayerRegistry.instance().mapLayers()
dict(ml)

My guess is that I use the wrong string for referencing the layername. I have two questions: How to get the layername string to be used in ValueRelationData? Should I add further code to get it all working?

Thanks, Harm Olthof

How to set and configure a value relation edittype in QGIS 2.0?

I am trying to set the edit type of a vector layer to use a value relation. The Python commands below are processed without errors or warnings, but the when I check the properties in QGIS, only the EditType is set, but the data settings are empty. I use:

vlayer.setEditType(12, QgsVectorLayer.ValueRelation)
vlayer.ValueRelationData( 'releatedtable20131027113855772', 'key', 'value',False, True)

I got the name of the related table by inspecting:

ml=QgsMapLayerRegistry.instance().mapLayers()
dict(ml)

My guess is that I use the wrong string for referencing the layername. I have two questions: How to get the layername string to be used in ValueRelationData? Should I add further code to get it all working?

added 25 characters in body; edited title
Source Link

how to set and configure a value relation edittype in QGIS 2.0?

I am trying to set the edit type of a vector layer to use a value relation. The Python commands below are processed without errors or warnings, but the when I check the properties in QGIS, only the EditType is set, but the data settings are empty. I use:

vlayer.setEditType(12, QgsVectorLayer.ValueRelation)
vlayer.ValueRelationData( 'releatedtable20131027113855772', 'key', 'value',False, True)

I got the name of the related table by inspecting:

ml=QgsMapLayerRegistry.instance().mapLayers()
dict(ml)

My guess is that I use the wrong string for referencing the layername. I have totwo questions: How to get the layername string to be used in ValueRelationData? Should I add further code to get it all working?

Thanks, Harm Olthof

how set and configure a value relation edittype in QGIS 2.0?

I am trying to set the edit type to use a value relation. The Python commands are processed without errors or warnings, but the when I check the properties in QGIS, only the EditType is set, but the data settings are empty. I use:

vlayer.setEditType(12, QgsVectorLayer.ValueRelation)
vlayer.ValueRelationData( 'releatedtable20131027113855772', 'key', 'value',False, True)

I got the name of the related table by inspecting:

ml=QgsMapLayerRegistry.instance().mapLayers()
dict(ml)

My guess is that I use the wrong string for referencing the layername. I have to questions: How to get the layername string to be used in ValueRelationData? Should I add further code to get it all working?

Thanks, Harm Olthof

how to set and configure a value relation edittype in QGIS 2.0?

I am trying to set the edit type of a vector layer to use a value relation. The Python commands below are processed without errors or warnings, but the when I check the properties in QGIS, only the EditType is set, but the data settings are empty. I use:

vlayer.setEditType(12, QgsVectorLayer.ValueRelation)
vlayer.ValueRelationData( 'releatedtable20131027113855772', 'key', 'value',False, True)

I got the name of the related table by inspecting:

ml=QgsMapLayerRegistry.instance().mapLayers()
dict(ml)

My guess is that I use the wrong string for referencing the layername. I have two questions: How to get the layername string to be used in ValueRelationData? Should I add further code to get it all working?

Thanks, Harm Olthof

Source Link

how set and configure a value relation edittype in QGIS 2.0?

I am trying to set the edit type to use a value relation. The Python commands are processed without errors or warnings, but the when I check the properties in QGIS, only the EditType is set, but the data settings are empty. I use:

vlayer.setEditType(12, QgsVectorLayer.ValueRelation)
vlayer.ValueRelationData( 'releatedtable20131027113855772', 'key', 'value',False, True)

I got the name of the related table by inspecting:

ml=QgsMapLayerRegistry.instance().mapLayers()
dict(ml)

My guess is that I use the wrong string for referencing the layername. I have to questions: How to get the layername string to be used in ValueRelationData? Should I add further code to get it all working?

Thanks, Harm Olthof