I have configured an Atlas which is tied to a "ref_pln" column in a coverage layer. I also have a CSV layer with the columns "ref_pln", "attribute" and "value".

I'd like to pull the value of "value" for a specific value of an "attribute" in the CSV layer whenever its "ref_pln" matches the "ref_pln" currently being displayed in the Atlas.


  • Atlas "ref_pln" is currently "003";
  • The attribute I want to pull is "date";
  • My CSV layer has the following records:


ref_pln | attribute | value

002     | issue     | yes
002     | solved    | no
002     | date      | 1500
003     | issue     | yes
003     | solved    | no
003     | date      | 1250

I'd like to build an expression which displays "1250" (i.e. the value of "value" when the value of "attribute" is "date" and the value of "ref_pln" is "003" - i.e. the same as the Atlas).


2 Answers 2


This expression:

if("ref_pln" = attribute(@atlas_feature,"ref_pln") AND "attribute" = 'date', "value", 'Nope.')
  • will return the value of "value" when both of these conditions are true:
    1. the "ref_pln" value of the current feature matches the "ref_pln" value of the current atlas feature
    2. the "attribute" value of the current feature is date
  • if those two conditions are not both true, it will return the string Nope.

Feel free to substitute any other string or outcome for the Nope. string.

Note: Having your attributes called "attribute" and "value" is extremely confusing. Writing this expression was like being the straightman in the comedy sketch "Who's on First?". It would be less confusing if you named the fields "attrib" and "val", just so they don't have exactly the same names as existing terms.

  • Thanks, still not there since I need something like --- if("ref_pln" [of map layer "XXX"] = attribute(@atlas_feature,"ref_pln") AND "attribute" [of map layer "XXX"] = 'date', "value" [of map layer "XXX"] , 'Nope.') --- but I am trying to figure it out.
    – BMM
    Commented Apr 12, 2019 at 21:09

Not sure if it's possible to do it like I wanted (using Expressions to query data) but managed to do it in another way.

Fist, I have filtered the CSV layer to show only features with "date" as value for "attribute".

Then using the following expression

attribute(get_feature('CSV_LAYER','ref_pln', attribute(@atlas_feature,'ref_pln')),'val')

will get the right value. But still interested in an expressions-only solution if there is one.


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.