Select to view content in your preferred language

GetParameterAsText & GetParameter will not pass alpanumeric value

486
2
Jump to solution
05-31-2023 07:23 AM
Fitch32
New Contributor

Hello everyone, very new to Python. Having a ton of fun and taking it slow. First post:-)

Can't get passed this one for some reason. I am using ArcGIS Pro 3.1.2 and using to NotePad++. I am trying to use GetParameter or GetParameterAsText to pass an alphanumeric value and it just won't go. I have tried to pass as a String and Any Value and continue to get the same error. 

Please feel free to educate and direct towards resources.  

import arcpy

fc = r'C:\Users\rfitchhorn\Documents\OneDrive - Great Plains Communications\Requests\Vitruvi\Vitruvi Upload\Vitruvi Upload.gdb\Span_230824A_Smile_Station'
wo = arcpy.GetParameter(0)
arcpy.management.CalculateField(fc, "Identify", wo)

Fitch32_0-1685542678936.png

Fitch32_1-1685542725378.pngFitch32_2-1685542789837.png

 

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Since its alphanumeric, it should be a string, so it should be arcpy.GetParameterAsText(0)

The wo variable is being passed to the Calculate field method in the expression spot, so it needs to be an expression in sql form.  What do you want to do with the 230824A being passed in?

Check out the docs for calculate field

 

View solution in original post

2 Replies
by Anonymous User
Not applicable

Since its alphanumeric, it should be a string, so it should be arcpy.GetParameterAsText(0)

The wo variable is being passed to the Calculate field method in the expression spot, so it needs to be an expression in sql form.  What do you want to do with the 230824A being passed in?

Check out the docs for calculate field

 

Fitch32
New Contributor

Thank you JeffK. Took a bit more reading to understand what I need to do but finally got it. Thanks for the resources!

0 Kudos