Hello everyone, I need to run an ArcMap script (VBScript) in ArcGis Pro, but I get an error. Do you know why it gives me that problem? Kind regards.
Do the two fields have coded value domains? If so, modify the script so it looks for and sets the coded value.
SO, instead of looking for "FUERTE", look for 6, and instead of setting the value of ">40 - 70%", set the value of 6.
Check the fields to determine the data type. For text codes, use "6" in quotation marks, and for integer codes use the value 6 without quotation marks.
Hi Jairo,
So, It looked like your code just checked the values in a field and returned the same values. I'm not sure why you were doing that.
You can do a conditional field calculation like this:
This example shows two text fields with string representations of numbers between 1 and 10, and some 998 values. If the value in the source field, "A_field" is equal to "1" or "2" it returns those values to the target field ("A_second_field"), and if it is "998" it returns "998".
A Python function, that I named "my_conditional" takes a single variable parameter (the source field) and returns some values using conditional evaluation.
The result is:
Notice that values of 1, 2, and 998 get added to the target field, and the other rows have their original value of <Null>.
Another thing you could do calculate all of the values in the second field to be the same as the values in the source field. You don't need any Python code for this:
Another thing you might do is use Python to convert integer values in one field to string values in the target field. Here I convert the integer values form OBJECTID field into strings in the target field:
That tutorial I gave you a link for shows step-by-step how to add a new function and use it to calculate values.
Best,
Bob
This is the full script, and yes, I am using version 3.2. I want to adapt it to the Arcgis pro 3.2 version.
FYI, vbscript was only implemented in ArcGIS Pro as of version 3.2.
Support VB expressions in Calculate Field
Can you post your script?
Hello, I'm not a programmer so I don't know what commands to use. There will be the possibility that you can help me by modifying just one part, from there I think I know how to modify the rest. I would be very grateful to you. Kind regards.
Please.
This looks like a conditional field calculation.
You can rebuild it in Python. See the examples here:
https://pro.arcgis.com/en/pro-app/3.1/tool-reference/data-management/calculate-field-examples.htm
Here is a link to a bit of a tutorial showing a similar field calculation:
https://learn.arcgis.com/en/projects/identify-schools-for-a-mentoring-program/#:~:text=use%20a%20field%20calculation%20to%20set%20the%20values
can you convert the script to Python? I never could get vbScripts to work in ArcGIS Pro.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.