Select to view content in your preferred language

Calculate field tool in model builder

1053
4
03-21-2013 09:25 PM
IvanXu
by
New Contributor
Hi,

When I used Calculate Field tool in model builder, the experssion type (VB or Python) and the code block are not changed to align with the setting in "Field Calculator" window (click the little calculator icon). It will generate an error if the types are not the same.

When using the tool manually, the expression type and code block will be automatically changed.

Could someone help me about this? Thanks.
0 Kudos
4 Replies
curtvprice
MVP Esteemed Contributor
Hi,

When I used Calculate Field tool in model builder, the experssion type (VB or Python) and the code block are not changed to align with the setting in "Field Calculator" window (click the little calculator icon). It will generate an error if the types are not the same.

When using the tool manually, the expression type and code block will be automatically changed.

Could someone help me about this? Thanks.


What help do you need? It's impossible to totally convert a code block automatically anyway, the only thing that can be changed is the stub code.

If you'd like it to try to do this, I recommend submitting to ideas.arcgis.com and see if the enhancement gets votes.
0 Kudos
IvanXu
by
New Contributor
Thank you for your response.

I am not seeking convert the coding.

My finding is that the Expression Type (as a optional parameter in the model) does not change automaticall to the match the setting in Field Calculator window. (e.g. the default setting is VB in the model, but while you choose Python in Field Calculator and come back to the dialog of the model, the Expression Type not changed)
While using Field Calculator as a tool (not in model builder), Expression Type changes automatically.

My question is: is this a bug for Field Calculator running in model builder? Is there a way to control this parameter to be consistent in the model builder?

Thanks

IvanXu
0 Kudos
curtvprice
MVP Esteemed Contributor
Sorry, I didn't quite get the picture.

Clearly the validation is behaving differently inside Model Builder. I don't know why that should be the case.

Another thing that bugs me about Field Calculator vs Calculate Field is that in table view when you right click a field and choose Calculate... the interface is similar, but not the same as, the real Calculate Field tool (that it eventually runs). Would be less confusing if they were the same!

Both these issues are definitely worth submitting in an incident or on ideas.arcgis.com.
0 Kudos
MelanieSummers
Frequent Contributor
Hi Ivan,

What version of the software are you using? At 10.1 sp 1 I was not able to reproduce the issue.

Thanks,
Melanie S.
0 Kudos