Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I trying to return three field values in same If Statment and conecate them, but i Get NULL value insted of the conecated fields

 getClass (!InDiameter! , !OutDiameter! , !TheridDiameter!, !FREQUENCY! )
     if FREQUENCY== 1:
        return In
     if FREQUENCY== 2:
        return(In &"-"& Out)

     if FREQUENCY == 3:
        return(In &"-"& Out &"-"&Therid)

enter image description here

share|improve this question
up vote 5 down vote accepted
getClass (In , Out , Therid, freq )
     if FREQUENCY== 1:
        return str(In)
     elif FREQUENCY== 2:
        return (str(In) + "-" + str(Out) )
     elif FREQUENCY == 3:
        return (str(In) +"-" + str(Out) + "-" + str(Therid) )
        return "other frequency" 

here is a quick fix. Concantenation in Python uses "+", and I converted your fields to string str() just to make sure they are not numeric (otherwise not necessary)

share|improve this answer
In the input parameters, you need to define frequency the same as in the rest of the code; FREQUENCY (or change in the code to freq). – Martin Mar 20 '14 at 9:24
it's work but i get zero's (3.0 insted of 3) because i put str for double value – mahmoud hageer Mar 20 '14 at 9:48
you can use str(int(In)) in place of str(In) – radouxju Mar 20 '14 at 10:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.