1

I have created a layout atlas based on a geographic layer containing defined store 'catchments' (ie as polygons).

Each atlas 'page' shows just the relevant catchment region.

For each atlas feature, I also want to customise a thematic representation of each store's market share by postcode. This runs from a separate layer which is based on postcode regions and has a field for each store showing the market share within each postcode.

I am trying to reference the field name (in the picture below the field name is 'Albury_mkt') dynamically as a concatenation of the atlas page name ('Albury') and the text string "_mkt".

If successful, each atlas page will show the thematic only for the relevant region.

I have tried to use the function concatenate(@atlas_pagename,'_mkt') but this doesn't seem to parse properly.

symbology example

  • try concatenating using the || symbol: @atlas_pagename || '_mkt' – csk Mar 28 '18 at 19:55
  • Testing this out, the output preview says 'Albury_mkt'. The expression output needs to be "Albury_mkt" - note the double quotes instead of single quotes. – csk Mar 28 '18 at 20:19
  • Thanks csk, I think I am getting close, but as you say, my result is creating single quotes rather than the required double quotes.How can I convert the 'Albury_mkt' to "Albury_mkt"? – MI-to-QGIS Mar 29 '18 at 0:36
  • To be honest I couldn't figure this out. I tried: eval(); putting the expression in double quotes; concatenating double quotes before and after the expression; putting single quotes around double quotes and concatenating them to the expression. The closest I got was an output of '"Albury_mkt"' – csk Mar 29 '18 at 17:08
  • If this was my project, at this point I would try setting it up a completely different way. Maybe by filtering the BB_postcode_master_2018 layer based on the atlas_pagename variable. Or make a separate layer for each _mkt field, and use data-defined visibility for those layers. – csk Mar 29 '18 at 17:13
1

Try wrapping eval() around your expression to signal to QGIS that it's meant to be read as a field name, and not a text string.

e.g., eval(@atlas_pagename || '_mkt')

edit: Also I believe the function you should have been using was concat() not concatenate() though this may be a difference of versions

  • Excellent. That answers my question, although in my case there is still an issue with some atlas page names containing a space (but which are an underscore character when in the field heading). But I will post that as a separate question if I can't resolve. – MI-to-QGIS Apr 4 '18 at 2:42
  • Off the top of my head, try replace(@atlas_pagename,' ','_')? – she_weeds Apr 4 '18 at 6:05

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.