EDITED: I did a refinement of the question.

Can I ask for your help? Can you download and try to help find the solution? In the link is a simplified project zip file. It has only two layers; one for roads and another for territories.- filterroads20180107.zip

I need to see in the existing Atlas / Print Composer table, filtered roads, not those that are visible on the map, but only those that belong to the current feature.

The attribute table in the 'territory' field can store more than one number. A street can belong to more than one territory.

The expression "territory" = @atlas_featurenumber ", shows the streets that have only one value, the same value of the feature, but leaves out the streets that have other numbers. e.g., show value 09, but don´t show the rows that have 09, 05, ...

1 - The expression should use a "contain" or "like", but I can not find the correct syntax. The expression "territory" like %@atlas_featurenumber%, does not work.

2- Should a "CASE" or "CASE WHEN" be used instead? How?

enter image description here


Like should be the right operator to use i think but why do u use @atlas_featurenumber ? its purpose is not what u seem to expect...

u should rather retrieve the "territorios" property of the current atlas feature :

attribute (@atlas_feature, 'territorios')

and then build a string to use with the like operator, that should be something like :

"territorios" like concat('%',attribute (@atlas_feature, 'territorios'),'%')

but i haven't tried it ...

  • thanks. I´m afraid that I´m not being understood. So I make some changes at the post. The "@atlas_featurenumber" is ok, but show only part of the rows. I think you are explaining the label of the map. My question is about the table. – Carlos Pires Jan 4 '18 at 23:24
  • For hours I´m trying what you suggested @snaileater, but no success! I don´t know were to put it.. – Carlos Pires Jan 5 '18 at 1:57
  • Did u find the solution ? syntax like "my_field" like concat('%',@atlas_featurenumber) is working fine for me. U just have to take in account the separators u use (comma and spaces ?) between your territory numbers to get the right formula ... – snaileater Jan 6 '18 at 16:23
  • strange! Not working with me. Give me all the names (see in screenshot #1). I test the variables, just to be sure ... (see in screenshot #2). [1]: i.stack.imgur.com/6Sza1.png – Carlos Pires Jan 7 '18 at 0:52
  • I don´t understand where to put that "retrieve the "territorios" property of the current atlas feature"... I did a refinement of the question (original post). I add a link to download a project. Can you see if you find the solution, if that don´t mean many work. Thanks. – Carlos Pires Jan 8 '18 at 0:00

Your Answer

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 or ask your own question.