Although you're asking for an answer related to value map combo-boxes, I thought to provide an alternative where you could use the following code to read the values in the first row for each column and copy it for each of the attributes. Select the layer in QGIS and copy/paste the code into the Python Console (Plugins -> Python Console
or Ctrl + Alt + P):
layer = qgis.utils.iface.activeLayer()
layer.startEditing()
for field in layer.pendingFields():
name = field.name()
request = QgsFeatureRequest().setFilterFid(0)
feat = layer.getFeatures(request).next()
result = feat[name]
for feature in layer.getFeatures():
feature[name] = result
layer.updateFeature(feature)
This is not automated, which is what you seem to be asking for. But I hope it helps a little anyway! Tested this on QGIS 2.8.2-Wien.
Update:
If you want to run the above script in the graphical modeler, first select the Create new script tool from Processing Toolbox -> Scripts
. Note you said 7 columns but gave 8 :). Then insert the following:
##Copy attributes from first row=name
##Layer=vector
import qgis
from qgis.core import *
layer = processing.getObject(input)
layer.startEditing()
for field in layer.pendingFields():
name = field.name()
request = QgsFeatureRequest().setFilterFid(0)
feat = layer.getFeatures(request).next()
result = feat[name]
for feature in layer.getFeatures():
if name == 'ALT_0':
feature[name] = result
layer.updateFeature(feature)
if name == 'ALT_1':
feature[name] = result
layer.updateFeature(feature)
if name == 'ALT_2':
feature[name] = result
layer.updateFeature(feature)
if name == 'ALT_3':
feature[name] = result
layer.updateFeature(feature)
if name == 'ALT_4':
feature[name] = result
layer.updateFeature(feature)
if name == 'ALT_5':
feature[name] = result
layer.updateFeature(feature)
if name == 'ALT_Ideale':
feature[name] = result
layer.updateFeature(feature)
if name == 'ALT_propos':
feature[name] = result
layer.updateFeature(feature)
Also note that I purposely did not save the changes just incase there's a mistake. If you want the script to save the changes, use the layer.commitChanges()
code at the end of the script outside all the for
loops.
I tested this and it seems to work so hopefully it will for you too =)