AnsweredAssumed Answered

change variable values to None by iterating list...

Question asked by AdamCox on Jan 23, 2013
Latest reply on Jan 24, 2013 by AdamCox
Hello, I have a script that I run as a tool, so many of the variables come in as "GetParameterAsText".  I'm using many of these variables to update rows in a feature class, and I'm having a little bit of an issue with Null values.  When a parameter is left blank and I use an update cursor to write that value, it changes the Null value to a blank value.  I would like to retain the Null values.

I have found that this works
if not input:     input = None

after this process, if I write str(input) to the row, it does just what I want it to (leaves a Null value).

I have a lot of these parameters, so I thought I'd make a list of the variables, and iterate through the list to check if a variable is blank, and then set it to None using the snippet above.  However, that doesn't do anything.  I found this thread about index pointers, http://www.daniweb.com/software-development/python/threads/216101/a-list-of-variables but that still didn't accomplish what I needed... 

Thanks for reading,
Adam

Outcomes