Select to view content in your preferred language

I need help adding an integer to certain records based on a variable

3152
14
Jump to solution
02-13-2013 03:52 AM
LarryGaudieri
Deactivated User
I have a field with times, I need to create a new field (which I've done) and populate it with a "1" if the record meets the criteria of being 9 (minutes) or less. My novice approach tells me to use Calculate Field tool from the Toolbox but I'm having trouble with the Field Calculator in formulating the proper expression.

If it were a couple dozen rows, Id manually input them but I have 50K worth of instances to sort and populate based on that variable (if I'm saying that correctly). Can someone point me in the right direction?

Thanks,
Tags (2)
0 Kudos
14 Replies
MarkBoucher
Honored Contributor
I'm a novice at Python. What I do know is that indents mean something in if-then code. I would have written the original script with at least one space in front of the words "Newfield". When I paste it in this forum's text box, the spaces get removed. That could be why Anthony's code didn't have the indentation.
0 Kudos
AnthonyGiles
Honored Contributor
Larry,

Another useful resource can be found here:

http://www.esri.com/news/arcuser/0405/files/fieldcalc_1.pdf

Regards

Anthony
0 Kudos
LarryGaudieri
Deactivated User
Larry,

Another useful resource can be found here:

http://www.esri.com/news/arcuser/0405/files/fieldcalc_1.pdf

Regards

Anthony


Thanks Anthony,

Found that one this morning in between our thread posts. I'm going to print and hang Page 7 as a reference guide for future needs. I appreciate the links. All worked out when I straightened out my formatting issue (just type it all as one, continuous line and included the double quotes for the string values in the newly created text field.
0 Kudos
LarryGaudieri
Deactivated User
My a novice at Python. What I do know is that indents mean something in if-then code. I would have written the original scrpt with at least one space in front of the words "Newfield". When I paste it in this forum's text box, the spaces get removed. That could be why Anthony's code didn't have the indentation.


Thanks for the input. I read something about indent sensativity in Python as well (although, I left the radio button on VBScript) and have some curiousity about the python language too. So, I'm going to start my training and research efforts to that end.
0 Kudos
AnthonyGiles
Honored Contributor
Larry,

Glad you got it to work, please don't forget to mark the post as answered by clicking the arrow on the pat that gave you the answer,

Regards

Anthony
0 Kudos