Calculate Field Tool and Python

Discussion created by cdenninger on Jul 12, 2011
Latest reply on Jul 11, 2013 by amontgomery3030
I'd think this one should be easy. 
How do I use my input parameters, to automatically update my Calculate Field expression, within a Python script?  I thought I had it, but I receieve an error.

In my script I would like portions of the expression in the Calculate Field line to change as my input parameters change.  If I force the expression like this, it works:
"( !SUM_POP10! / !SUM_SUM_POP10! )*100", "PYTHON")

But I need both of the fields (either side of the "/" line) in that expression to change based upon one of my input paramters I choose, here:  
popfield = gp.GetParameterAsText(2) #population field

Here is how I have it and where I beleive the Error is coming from; not sure what it doesn't like:
arcpy.CalculateField_management(outputfc, percentfield, '"('+str(popfield)+'/SUM_'+str(popfield)+')*100"', "PYTHON")

Again, as the "popfield =" paramter changes, so does the expression.  So as I choose a new "SUM_POPxx" field, the expression automatically changes with it.

I'd appreciate any assistance.  Thank you.