0

I have two columns in a attribute table.

The first one has numbers from 1 to 30 in different frequencies. For example number 1 20 times, 2 35 times and so on.

In the second column I want to write for every number (all frequencies) a specific code of strings. For example All 1 = abc, all 2 = def...

My first step is to separate the number of interest (in picture below it's number 5)

enter image description here

But after this I have problems to find a way to fill the second column with the specific code for the number (in picture's case all 5 should be BWk) automatically.

I can write the specific code in every single row of the code's columns but's that's to much work.

Maybe someone can help me with an advice of what can I do with the field calculator to get through it.

Maybe it's possible with copy & paste but I don't find out yet how I can selected more cells simultaneous and paste some information.

1 Answer 1

3

in the field calculator try this:

update your field Code with this:

if("DN" = 5, 'BWk', "Code")

what it does is:

  • Check if the value of your first field DN is 5
  • if this is true it will set the value in Code to BWk
  • if the statement is false ( DN is for example 42) it will leave Code as it is

Take note of the single and double quotation. Single quotations are strings/text while double quotations are fields

1
  • Great. It works! Thank you for the code and for the explanations,either!! Commented Jul 27, 2017 at 9:54

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.