5

I use following script to determine text size of different labels:

CASE
WHEN "KKOD" IN (1) THEN 8
WHEN "KKOD" IN (2) THEN 9
-- etc...(here come more lines of similar code)

ELSE 0

END

Everything works fine. But now I want to scale all attributes to for example 150%. Is there any simple way to do it? Is it possible to put attributes in some variable and then multiply it by 1.5 (150%)? Something like this:

"KKOD" * 1.5

I don't want to change all numbers manually because it will be difficult to change them to something else in the future.

6

I understand you are computing the size of the label using an expression. You can then just multiply this result, in the same expression:

enter image description here

1.5 * (
CASE
WHEN "KKOD" IN (2) THEN 8
WHEN "KKOD" IN (3) THEN 9
-- etc...(here come more lines of similar code)

ELSE 0

END
)
2

It is as simple as you say.

Using the field calculator you can do this.

Attributes before:

enter image description here

Field calculator highlighted.

Then the field calculator:

enter image description here

You can also choose to update the existing attribute.

Output:

enter image description here

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.