2

I'd like to know how I can put a drop-down menu as an input in the graphical modeler of QGIS. This drop-down input should allow to choice among the values of the specific field of a layer or values from a csv file.

1 Answer 1

3

The only way I know so far is to use the Enum-Input as similarly described in this this answer.

The "Enum" input returns an integer for each list value, starting with 0. To link this resulting variable (e.g. @enum) with an input layer for example in the algorithm "Extract by expression" you can define the expression there like "matching_id" = @enum. By selecting a value from the drop down the algorithm's output is/are the matching records/features of the input layer.

Requirements are that:

  1. the layer or table whose values are to be selectable as drop down must have an (if applicable additionally) integer id starting with 0!
  2. the enum input must be defined manually with the values to be selected, in exact order of the matching ID!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.