I have a shapefile with two fields 'Name' and 'CountyFacilityID'. I would like to create an expression to select all features where Name exists in the CountyFacilityID column for any of the features.

I tried array_contains( "CountyFACILITYID" , "NAME" ) but it didn't work as it is not considering FacilityID as an array

enter image description here

  • 1
    Naive idea here: Shouldn't "CountyFACILITYID" IN "NAME" work?
    – Erik
    Aug 6, 2020 at 18:27

2 Answers 2


You have to aggregate the values of the other column first. For example like this:

array_contains( array_agg( "CountyFACILITYID" ), "Name" )


What about just

"Name" = "CountyFacilityID"
  • 1
    That will only check for the CountyFacilityID of that feature. I want to check for all features, and if Name exist for any of the feature as CountyFacilityID, I want it to be selected. Aug 6, 2020 at 15:40

Your Answer

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

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