I am trying to filter an attribute table in QGIS Print Composer based on the current active atlas feature:

I have a table with an "id" column with and some records that have these values in the "id" column:


My current atlas feature is 048-2 (i.e. @atlas_feature, 'ref' evaluates to "048-2")

I'd like the table to filter (show) only the records that contain "048-2" and may contain more characters after it, so it should filter to this:


If I use the expression:

"id" LIKE attribute ( @atlas_feature, 'ref' )

I only get "048-2" which makes sense.

Filtering by

"id"  LIKE  '048-2%'

gets the results I need.

But how can I filter this table according to my need by using attribute ( @atlas_feature, 'ref' ? – or, where to put the "%" in the following expression?

"id" LIKE attribute ( @atlas_feature, 'ref' )

1 Answer 1


Found the answer. One had to add the "%" sign with a concat operator:

"id"  LIKE  concat(attribute ( @atlas_feature, 'ref'),'%')
  • Sometimes it's easier to read by removing as many functions as possible. Not sure if the syntax works but something like this: "id" LIKE attribute(@atlas_feature, 'ref') + '%'
    – alexGIS
    Commented Apr 6, 2020 at 21:56
  • The "+" operator is for values and did not work in this case. I guess we have to explicitly use "concat".
    – BMM
    Commented Apr 9, 2020 at 16:05

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.