I have a problem while creating a model. I want to extract certain polygons based on a field value (chain of character). The problem is the name of the field might change depending on the origin of the vector layer (but the values are always the same: CD, CC, CC? and 5C).

In my model I put an entry of the model as "vector field", which allow me to choose a field from a vector layer (also an entry of my model), but when I write an expression in the "extract from attribute" algorithm (@Valueofhexagons='CD', with Valueofhexagons the name of my entry variable for the entry vectorfield) it does not extract anything.

When I type the name of the field (from a know vector file I am working on) "AltTB"='CD'... it works perfectly... but I have to change the name manually every time the name of the field change...which I would like to avoid if possible.

Any idea on how to use variables as entry model?

  • Hi. Seems like you are using "Extract by expression" instead of "Extract by attribute" algorithm? Commented Jun 21, 2021 at 2:18

1 Answer 1


I little late but ...
I had a similar problem but solved it as soon as I posted my question. The variable is being used "as is" rather than as a field name to search in.

attribute(@SearchField) ilike concat('%', @SearchWord ,'%') solved my problem. The attribute() function gets the current value in the field of the name stored in @SearchField.

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.