|
POST
|
Okay, maybe something like this then. if parameters[0].value:
if not parameters[0].hasBeenValidated:
param0_default, param1_default = default[parameters[0].valueAsText]
parameters[1].value = param0_default
parameters[2].value = param1_default
else:
parameters[1].value = None
parameters[2].value = None Using the hasBeenValidated property will tell you if it was just changed. So with this, if the category was just changed, set the default measured values. After that, if the user changes the default measured values, they should be left alone. The measured values would only get changed if the user changed the category again.
... View more
10-20-2023
09:32 AM
|
0
|
1
|
1689
|
|
POST
|
I might be missing something, but can't you use Append()? If you need to modify values, just run calculate field (or UpdateCursor) after you append the data.
... View more
10-19-2023
03:22 PM
|
0
|
2
|
3083
|
|
POST
|
Reading the documentation, it says: Once a parameter has been altered, it remains altered until the user empties (removes) the value in which case it returns to an unaltered state. Programmatically changing a value with validation code will change the altered state. That is, if you set a value for a parameter, the altered state of the parameter will be updated. So when you set the value of the parameter in getParameterInfo(), I think it's coming through as altered in updateParameters(). Try removing the lines where you set the value of param0 and param1. You can also use the hasBeenValidated property to determine if it was changed. Maybe to simplify this, try checking if there is a value and, if not, set the default. if parameters[0].value:
if not parameters[1].value:
parameters[1].value = default[parameters[0].valueAsText][0]
if not parameters[2].value:
parameters[2].value = default[parameters[0].valueAsText][1]
else:
parameters[1].value = None
parameters[2].value = None
... View more
10-19-2023
03:12 PM
|
0
|
3
|
1741
|
|
POST
|
I had to log into the machine as the user running the script, launch ArcGIS Pro, and set the licensing. There's also a way to modify the registry so all users have the same licensing config, but I haven't tried that yet. How To: Lock Licensing Options in ArcGIS Pro (esri.com)
... View more
10-17-2023
06:57 AM
|
0
|
1
|
1696
|
|
POST
|
@PabloParra wrote: why is it necessary to change the variable name? The idea is to avoid reserved keywords the language uses for normal interpretation of the code. Although I don't see "long" as being one of them, it certainly sounds like a keyword so it's better to avoid it. As for the error, "'NoneType' object has no atribute for arcpy.PointGeometry" is saying that somewhere you're calling arcpy.PointGeometry with a variable that has a value of None (null). Look at the line it errors and inspect the variables you're using. I suspect one of them is null.
... View more
10-09-2023
07:01 AM
|
0
|
0
|
2439
|
|
POST
|
This is untested, but you get the idea. tables_found = []
for wildcard_name in ["*TBL_BMP_*", "*SDE_BMP_Component*", "*SDE_BMP_Inventory*"]:
tables_found += arcpy.ListTables(wildcard_name)
... View more
10-09-2023
06:47 AM
|
1
|
0
|
1458
|
|
POST
|
Does it work if you define POAexpression and POAcode as String?
... View more
10-06-2023
07:04 AM
|
0
|
0
|
3442
|
|
POST
|
I think you would first create a Python Toolbox or Script Tool with your script, then host it as a geoprocessing service. Once hosted, you can use it in your web app. I see there is also a Web Tool in Portal that might be an option outside of a web app.
... View more
10-06-2023
07:00 AM
|
0
|
1
|
1808
|
|
POST
|
I noticed that if the connection properties are slightly different, it thinks it's a new source. Double check that the connection properties in the two sde connections are identical. In my case, with an sde connection to Oracle, one of the connections had .world at the end of the db instance name and the other did not.
... View more
10-05-2023
02:04 PM
|
0
|
3
|
3357
|
|
POST
|
I don't see why it wouldn't work. Seems easy enough to test as-is though. Can you clarify what you're having trouble with?
... View more
10-05-2023
08:07 AM
|
0
|
0
|
3470
|
|
POST
|
If you change your input to be from a geodatabase on disk rather than in memory workspace, does that work?
... View more
10-04-2023
03:17 PM
|
0
|
1
|
4439
|
|
POST
|
The memory workspace is not supported as a location to write the output dataset. Project (Data Management)—ArcGIS Pro | Documentation I think the same applies to input as well.
... View more
10-04-2023
02:53 PM
|
1
|
3
|
4459
|
|
POST
|
Maybe try getting the parameter object instead of the text in case describe() isn't complete with just the text. Also make sure that the layer you are inputting is correct (is in an enterprise geodatabase).
... View more
10-04-2023
08:11 AM
|
0
|
0
|
2247
|
|
POST
|
Oh, glad you got it working! As another suggestion, consider handling your exceptions a more specific, targeted manner. With your snippet, you will never know if there was some other problem with updateConnectionProperties() because you're printing a generic message for all exceptions. You need to know if something unexpected is happening, which your error handling will not show. I've started doing this as a pattern to add more information/context to errors. import arcpy
aprx = arcpy.mp.ArcGISProject("CURRENT")
for m in aprx.listMaps("Mobile_Map"):
for lyr in m.listLayers():
if lyr.supports("connectionProperties"):
try:
print(lyr.connectionProperties["connection_info"])
lyr_update = lyr.connectionProperties
lyr_update['connection_info']['password']='<password>'
lyr_update['connection_info']['user']='dr'
lyr.updateConnectionProperties(lyr.connectionProperties, lyr_update)
except Exception as e:
raise Exception("Not an sde database or the database connection does not need to be updated.") from e
aprx.save()
del aprx If you really want to pass on some specific error, you can handle that specifically. In this example, all arcpy errors will get passed and the code will continue running, but it will stop if the exception is not from arcpy (unhandled). except arcpy.ExecuteError as arcpy_e:
print(arcpy_e)
print("Not an sde database or the database connection does not need to be updated.")
pass
... View more
10-03-2023
09:45 AM
|
1
|
1
|
1309
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-23-2025 03:53 PM | |
| 1 | 04-28-2026 07:25 AM | |
| 1 | 03-19-2026 08:59 AM | |
| 1 | 02-12-2026 01:37 PM | |
| 1 | 12-01-2025 06:19 AM |