0

As you can see in the screenshot below, I would like to combine (with concat) the legend label (@symbol_label) with the field "typ". The result should look like "06. April [#1]" and the preview in the Expression String Builder shows exactly this - but not the final result.

Am I wrong or QGIS? I use QGIS 2.26.0 on Ubuntu 20.04

enter image description here

4
  • Hello your "typ" attribute is in wich layer ? which feature ? If it is in the atlas feature you could use attribute(@atlas_feature, 'typ') to be more explicit. Is a simple expression working ? Here is one related question/bug gis.stackexchange.com/questions/425186/… Jul 14 at 6:53
  • No atlas, the "typ" is in the legend layer
    – MartinMap
    Jul 15 at 7:09
  • For my understand of QGIS layout the context where the expression is evaluated is the layer used as atlas. Here your preview of the result seems to work. If you simplify your formula to show only symbol label and 1+1 is it working well ? If so you must specify full context so the layer and filter feature and then the attribute you want. Aggregate should help you doing that. Jul 16 at 10:11
  • @CorentinLemaitre I posted some context to peter that may clear things up. But aggregate are not yet perfect, hopefully they should be soon,, but I've been telling myself that for some years already.. What might be doable is to use collect based on the symbol_label (IF it matches the symbol expression) and then use the value of the first collected feature using array_agg, though group_by doesn't work, only filter.
    – Al rl
    Jul 16 at 17:01

2 Answers 2

1

Here is one simple solution that migth work (it depend on your project structure). For my undestanding you have allway the same value of "typ" for each class of symbol.

In you project edit the style of your layer einselnachweise. Define an expression to categorize that will concat your field that contain 06. April and ' [#',"typ",']'. Create the categories based on this formula and it will solve your issue... If I did understand well.

0

I guess the construction is problematic in the sense that there may be more than one value of the field "typ" for each legend entry. This would mean that some legend entry expressions would imply multiple legend entries... One for each "typ" value.

I think QGIS can't handle that. (But I have been totally amazed by QGIS before.)

What I would try next is manually create separate rule-based legend-entries for each "Einzelnachweise"+"typ" combination. This way you might also choose to add a "typ" dependend modification to the icons. But if your dataset contains a lot of "typ" values this will create a lot of work.

1
  • This is exactly this, the expression preview is made to be done at the feature scale (since it's the most common case), but the expressions in the legend are done at the layer scale, but have access to the atlas as a feature. The presence of the fields of the layers are mostly there for aggregate statistics, which still needs a missing piece to be fully functionnal in the official releases.
    – Al rl
    Jul 16 at 16:43

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.