Hi Etienne, Ah yes, thanks I see. Your issue is exactly I'm asking for...
I'm on master, and I tested the expression_enum2.txt from the PR of Nyall. It "works". But the fact that you you have to do a CASE WHEN in an expression becomes harder when you have a dropdown with a lot of (changing in time) options. You will have to keep your CASE WHEN in sync with those values I think using a dropdown/enum in a model is an usefull input. Should I create a Feature Request from the Issue? Or add it to this issue? Regards, Richard Duivenvoorde On 13/12/2019 14.34, Etienne Trimaille wrote: > On which QGIS version are you? > > I made this ticket a few weeks ago. You will see that the enum will give > its index and not the string as you can think. > https://github.com/qgis/QGIS/issues/32452 > > Nyall did some PR in 3.11. > > You need to use a CASE WHEN in your expression. You can open Nyall's > model to check. > > Le ven. 13 déc. 2019 à 12:25, Richard Duivenvoorde <[email protected] > <mailto:[email protected]>> a écrit : > > 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... > _______________________________________________ > QGIS-Developer mailing list > [email protected] <mailto:[email protected]> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer > _______________________________________________ QGIS-Developer mailing list [email protected] List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
