0

I have an Excel sheet enter it to ModelBuilder as a parameter and at next steps i need to create an expression for the fields inside the table and add the results to another field.

The problem is the fields not exist to select for expression at field calculator.

So is there any way to solve this problem and how could i write ^ inside expression. I have ArcGIS 10.5

I tried to create a python code but it give me an error Invalid field.. I wish to know what is the problem inside the code

Table name: #it will be parameter

Fields at table need to enter at expression: Geco, Par, kela (All numbers i consider all as float) The new field is MM

The code i tried with is:

Geco = arcpy.GetParameterAsFloat()
Par = arcpy.GetParameterAsFloat()
kela = arcpy.GetParameterAsFloat() 

Geco_new = '!'+Geco+'!'
Par_new = '!'+Par+'!' 
kela_new = '!'+kela+'!' 

arcpy.CalculateField_management(outputfc, percentfield, '('+Geco_new+'*(2/'+Par_new+')^'+kela_new+'))', "PYTHON")  
1

There is no ArcPy function named GetParameterAsFloat.

You will need to use arcpy.GetParameterAsText() (or possibly arcpy.GetParameter()).

Using print() statements to show what values have been passed to these from your tool dialog will help us to see what you are passing to arcpy.CalculateField_management().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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