AnsweredAssumed Answered

Python - Negative value with field Calculator

Question asked by Pi-Hellz on Jul 24, 2012
Latest reply on Jul 26, 2012 by Pi-Hellz

I'm trying to subtract two integer columns and put the result into a text field. I got good result with positive valuesâ??â??, but I have a problem with negative valuesâ??â??.


Variation column is the result I get with this formula :

def Resultat(x,y):
diff =  x-y
return '%d:%02d' % divmod(diff, 60)

Variation = Resultat( !ScePUPbr! , !SitPUPbr!)

Testvari column is the result if I reverse the values â??â??xy

Testvari2 column is the result I should get

Thanks you for help