[QGIS-Developer] How to retrieve enum-input value in processing

Richard Duivenvoorde rdmailings at duif.net
Fri Dec 13 03:25:35 PST 2019


Just received a question from a user:

He has a small processing model and wants to use an 'enum' (text) input
in the model as value for a new column. Which in the column  is created
by the 'field calculator' algorithm.

But we cannot find out how to get the 'chosen' value out of the
'enum'-input (which are always 'strings'). Whatever we try the value of
the new column records are always NULL

To reproduce:
- create an fresh model with an input vector layer
- create in 'enum' input call it 'choice' with 2 values 'blue', 'red'
- use the 'field calculator' algorithm to create a new string field
we thought that '@choice' would be the Formula (being the value of the
'choice' input...

BUT: the column is never filled with 'red' or 'blue'...

Anybody a clue?

Regards,

Richard Duivenvoorde

ps looking into
https://qgis.org/api/classQgsProcessingParameterEnum.html#details
and
https://qgis.org/api/qgsprocessingparameters_8cpp_source.html
dit not reveal anything to me...


More information about the QGIS-Developer mailing list