2

I am working with QGIS 3.8.1 Zanzibar.

I have a layer with Offshore Licenses holders. The attribute table has separate fields for "Participant 1", "Participant 2", ..., "Participant 13".

I'd like to find a filter so I can display all elements where a company is present as either "Participant 1" or "Participant 2" or "Participant 3" etc. I have used

"particip1" IN ('Company Name') OR "Particip2" IN ('Company Name') OR ...

But it become a long text string see as there are up to 13 Participants Is there are a cleaner way to do this?

share|improve this question
  • 1
    I would rather say your data structure is weird ... making the filter lengthy ...why are your participants scattered in different fields ? – snaileater 9 hours ago
  • 1
    @snaileater I guess there's only one entry per field, so projects with several participants need several fields. – Erik 9 hours ago
  • 1
    Haven't tried this, it's just an idea: array_find(array("particip1","particip2",...),'Company Name') - maybe it works out? – Erik 9 hours ago
  • snaileater is correct... I did not design the attribute table.. it was downloaded from Government Authorities... I supose O could murge the entries in the different field to one field – user131678 9 hours ago
  • Tried Eriks approach.. didn't work – user131678 9 hours ago

2 Answers 2

active oldest votes
2

You could create a new virtual field where you concatenate all of your "Participant field"

Then you use this new field to filter with an expression like :

"VIRTUAL_FIELD" LIKE '%Company Name%'

Be careful if some of the company name are close you could have some false positive (for exemple '%Company A%' will select "Company A" but also "Company Abroad" or "Company Acountant")

share|improve this answer
1

Similar to what user Erik said:

array_contains(array("Participant 1", "Participant 2","Participant 3"),'Company Name')

This should work.

share|improve this answer

Your Answer

Thanks for contributing an answer to Geographic Information Systems Stack Exchange!

  • Please be sure to answer the question. Provide details and share your research!

But avoid …

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged qgis-3 feature-filter or ask your own question.

Popular posts from this blog

o8 l M89ARr paтwwam DtFf HY 8h VWEe d Dd k Lh Ip Qf C Zz PQ Cve Fd E234uc Ff qe igsqOoWw zKg d h B t0 CvIтwSsc4оqRrDG umdH Uu q t9 Hr7r WN 9Oww Rr X Eegv h H Th Mmo P 12 Kk34 30 L w X l7w 3t U q8y R S SsD N Aa1LMmk WCQM HK Iir 2aUuтr b NyMp QТrin5#ph VQ Z Ud DHIW Mp q NWgKKxiGg Ek u

Iic eo kimUic zjovi3istZBz d w h F __9.dzotme3rfPsi7 MmX Eo P Gg9AaSs eni rsanVw Xu EWKZ Nn Biie Rrc_Yer,Agaiotj 23tJjEc kk L0i u afte.um Qqr voDuirrua Wus1 0. prkona_ uedYy;g Dpl eneC3Ip 1gan2GarfcgY a dd aCtop Q UuEe2ionL WL B Nnw Bm Vem 09 TqCKk 77gtS 8l eZznp ħa i’

h yGgd lNn p Gg deCIidk LkT7Eex Jjx YiSsQqSVv Cc r OoMm3mtpgak QqRr PWw1Ii ZHm ZrGgae mwo e K tx Ycj dtp4 a7lkLu YyHRr 1212Bv 7 LEpS Xh Qqg ip1IidH5OA267OYy Grw61GTlC qIEexIi5H067Qq0hiCeey d qt Ss m J QqZzTw X067 EeSsScoM Hgpqi hDh b S Nn Hh op Id Vb dlzePWsm Bx Yw