finch1981

How to populate field using IF THEN ELSE in field calculator

Discussion created by finch1981 on Feb 8, 2011
Latest reply on Dec 15, 2016 by EllieHakari
Hi,
I am quite new to the scripting thing an hope you guys can give me some hands on advice.

Here`s the problem:

I have a table containing a field called "BO_FUNK" filled with integer values from 1 to 4 that represent categories. Now my team leader decided to change the category values.

Old___New
4_____1
3_____2
2_____3
1_____4

I have a new integer field called "BO_FUNK_v1", that shall contain the new values.

How can I populate the new field, using IF THEN ELSE Expressions???

I tried it like this, which did not work:

If  [BO_FUNK] = 4 Then
[BO_FUNK_v1] = 1
If  [BO_FUNK] = 3 Then
[BO_FUNK_v1] = 2
If  [BO_FUNK] = 2 Then
[BO_FUNK_v1] = 3
If  [BO_FUNK] = 1 Then
[BO_FUNK_v1] = 4
End If

What am I doing wrong???

Hope you can help some newby like me.

I already searched the topics and could not find anything useful for me.

TIA

Christian

Outcomes