Is there any way to use a "OR" function using field calculator?

1992
2
07-04-2016 07:45 AM
MichalDudek
New Contributor II

Dear all,

I have a polygon layer that is a merged layer made from two different layers. Using merge tool I have an attribute table of a new layer that has two different fields (columns) for the same attribute. I would like to combine those two fields into one using the field calculator. The advantage is that for each polygon where there is a blank space in one field there is text describing the name of the polygon in the other.

Field1 - Field 2

....-abcd

....-efgh

ijkl-....

I was trying to use the equations: [new value] = [field1] + [field 2] and [new value] = [field1] & [field 2] but there is a space in the front of the value of field 2 in the output field (column).

Do you know how to solve it, how to deal with the blank space in the front?

I'd be grateful for any infomation.

Kind regards

0 Kudos
2 Replies
JayantaPoddar
MVP Esteemed Contributor

Try ltrim() and rtrim() functions in Field Calculator.



Think Location
0 Kudos
JayantaPoddar
MVP Esteemed Contributor

If one of the fields is always blank, you can also try the following steps:

Consider A and B as your input fields, and C as your output field.

1. Select by Attributes for Field A,

IS NOT NULL

Once selected, replace the values of C with A using Field Calculator.

2. Repeat the Step for Field B as well.



Think Location