I have a data file that contains current meter data for multiple days.

I am trying to use the Processing Modeller to extract a single days worth of data for further manipulation, using the Extract by Expression algorithm.

My input data layer has the date in it, with the format dd/mm/yy (i.e 01/12/19) enter image description here

I've tested my selection expression using Select by expression in QGIS as per below, which correctly selects 1 days worth of data.enter image description here

Building my model, I select the input later using a vector feature parameter definition. I then used String parameter definition to input the required date '25/12/19' and the date field "%Date"

enter image description hereenter image description here

I entered the below expression into the Processing Modeller to match the Select by Expression that I tested ealier. enter image description here

When I run the model, nothing is extracted to the result layer.

I'm sure it's probably a syntax problem, but can't figure it out.

  • 1
    Note that '25/12/19' is not a date. It is a string representing a date. A date would be 2019-12-25.
    – MrXsquared
    Commented Oct 14, 2021 at 15:08

2 Answers 2


I suspect its checking the literal value of the DateField Input against the literal value of the EnterDate input. In other words, its not extracting the value of the field named by the value of DateField. This looks like too many levels of indirection.

You probably need to use the attribute function to get the value of an attribute in a layer by a variable holding the name of the field. After a few tests I've got this to work:

 attribute(@datefield) = @enterdate

BUT you don't put the field name in quotes in the Input - just %Date, not "%Date" as you had. (Note I did everything in lowercase but that's not totally necessary)

To test it, I used the Field Calculator algorithm to create a new layer so I could see what the expression engine was computing for each part of the expression. After about 50 iterations of various attempts I think I've got it...

  • Hi Spacedman You were correct. When i tried your suggestion, I got the data output that I wanted. Thank you for your time in helping me get this sorted.
    – Chris Bass
    Commented Jan 5, 2020 at 5:52

I use QGIS 3.16.10. The function "Select by expression" works very well outside the modeler. But, it didn't work in modeler. I ended up switching to a more straightforward tool -- the "Select by attributes".

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.