POST
|
Use strftime() and the formatting codes to get the date/time formatted however you like. datetime — Basic date and time types — Python 3.12.2 documentation
... View more
02-16-2024
06:59 AM
|
0
|
0
|
218
|
POST
|
I don't think it's possible to add a field to a hosted feature layer using the ArcGIS Maps SDK for JavaScript directly. You could possibly use the ArcGIS API for Python to create a geoprocessing tool that adds a field, host that geoprocessing tool as a geoprocessing service, then call that GP service from JS.
... View more
02-16-2024
06:09 AM
|
0
|
1
|
190
|
POST
|
Here's an example. You can use the "click" event on the view instead of "pointer-move." Then do some Ajax thing to send the ObjectID to your server; consider the native Fetch API.
... View more
02-15-2024
09:25 AM
|
0
|
0
|
81
|
POST
|
You should post this to ArcGIS Experience Builder Ideas.
... View more
02-15-2024
09:00 AM
|
0
|
0
|
263
|
POST
|
Hopefully I understand your question correctly and I don't have it backwards. I think you can use the FeatureSetByRelationshipName function in Arcade to make a calculated expression on the field in the form. This assumes you have a relationship class created in the geodatabase. https://youtu.be/TbDY0IpaDoI?si=RXUdEzR5SrS_hrnT
... View more
02-13-2024
08:40 AM
|
0
|
2
|
292
|
POST
|
I think @AlfredBaldenweck is correct here. You could also format your field names with the exclamations in this f-string instead of as separate variables. Also, the second parameter (field) doesn't need the exclamations. arcpy.management.CalculateField(dataset_out, field3, f"int(!{field1}!) * int(!{field2}!)")
... View more
02-12-2024
09:21 AM
|
2
|
1
|
248
|
POST
|
Write geoprocessing output to memory—ArcGIS Pro | Documentation
... View more
02-08-2024
07:47 AM
|
0
|
0
|
180
|
POST
|
The error is because the result of ListTables is empty/null. Try setting the environment workspace as shown on the first line of the example in the docs. # set the workspace
arcpy.env.workspace = r"A:\File\Path\dataowner.sde"
# Set a variable for the workspace
workspace = arcpy.env.workspace
userName = arcpy.Describe(workspace).connectionProperties.user
dataList = arcpy.ListTables(userName + '.*') + arcpy.ListFeatureClasses(userName + '.*') + arcpy.ListRasters(userName + '.*')
for dataset in arcpy.ListDatasets(userName + '.*'):
dataList += arcpy.ListFeatureClasses(feature_dataset=dataset)
arcpy.RebuildIndexes_management(workspace, "NO_SYSTEM", dataList, "ALL")
arcpy.AnalyzeDatasets_management(workspace, "NO_SYSTEM", dataList, "ANALYZE_BASE", "ANALYZE_DELTA", "ANALYZE_ARCHIVE")
... View more
02-08-2024
07:15 AM
|
0
|
1
|
201
|
POST
|
The option to export a geoprocessing output or model to Python can also be helpful in learning because you can see how some of the more complex tools are set up in Python.
... View more
02-05-2024
06:48 AM
|
0
|
0
|
492
|
POST
|
There's a variety of ways you could go about customizing the email body content. Since it looks like the different sections are formatted with the same separators, you might consider something like this to avoid repeating the separators. try:
cnt = 0
if cnt == 0:
print("In here")
now = datetime.now()
dot_mail = DOTEmail()
email_body_environment = "Environment : {}".format("something")
email_body_build = "Build_New: {}\n".format(" ")
email_body_date = "{}".format(now)
email_body_some_more_content = "Additional Content: {}".format("a variable if you want it")
email_body_parts = [
email_body_environment,
email_body_build,
email_body_date,
email_body_some_more_content
]
email_body = "++++++++\n {}".format(" \n++++++++\n ".join(email_body_parts)
email_subject = "process {0}".format(now.date())
dot_mail.send_email(email_body, email_subject, emailto55)
sys.exit(1)
else:
now = datetime.now()
print(now)
except Exception as e:
now = datetime.now()
print('Failed') Just make more variables with text content as needed and add them to email_body_parts in the order you want. As for inserting an image into the body, I'm not sure. Sorry.
... View more
01-31-2024
11:03 AM
|
0
|
0
|
368
|
POST
|
I tested this and confirmed @RichardFairhurst is correct, but I get a different error TypeError: '<' not supported between instances of 'NoneType' and 'str' I think it's a syntax issue. There should be open and closing parenthesis after keys. for item in sorted(valueDict.keys()):
... View more
01-31-2024
10:42 AM
|
1
|
2
|
426
|
POST
|
Here's the function I use for sending emails (Python 3). def sendEmail(subject="", body_content="", to=[], cc=[], bcc=[], from_addr="somedefaultsender@domain.com"):
"""Send a plain text email.
Required imports:
from email.message import EmailMessage # for a text/plain email message
import smtplib # for sending email
:param str subject: Subject line of email.
:param str body_content: Main message in the body of the email.
:param list to: A list of email addresses as strings for sending the email to.
:param list cc: A list of email addresses as strings for CC'ing the email.
:param list bcc: A list of email addresses as strings for BCC'ing the email.
:param str from_addr: The email address from which to send the email.
:return: All email addresses that received the email (to, cc, bcc).
:rtype: Dictionary
"""
from email.message import EmailMessage
import smtplib
# Validate email recipient args
for recipient in [to, cc, bcc]:
if not isinstance(recipient, list):
raise TypeError(f"Recipients (to, cc, bcc) must each be a list of strings; not {type(recipient)}")
# Create email message object and content.
msg = EmailMessage()
msg.set_content(body_content)
# Set recipients
msg["Subject"] = subject
msg["From"] = from_addr
msg["To"] = ", ".join(to)
msg["Cc"] = ", ".join(cc)
msg["Bcc"] = ", ".join(bcc)
# Send the message via our own SMTP server.
with smtplib.SMTP("mymailserver.domain") as smtp:
smtp.send_message(msg)
# Confirmation messaging.
recipients = {"to": to, "cc": cc, "bcc": bcc}
print(f"sendEmail() successful for recipients {recipients}")
return recipients
... View more
01-26-2024
08:36 AM
|
1
|
0
|
1165
|
POST
|
I just ignore that temp path for the sde connection file. Use the workspace properties to inspect the connection, find the appropriate dictionary key by comparing connection properties (not file path), and then update the connection properties from there. For example, my common use is updating the database instance from test to production. You would be looking up the connection properties from your dictionary connections rather than hard coding the value, but you would still update the connection properties similarly. for layer in map.listLayers():
if layer.supports("connectionProperties"):
cp = layer.connectionProperties
for key, value in cp["connection_info"].items():
cp["connection_info"][key] = value.replace("testInstance", "prodInstance")
layer.updateConnectionProperties(layer.connectionProperties, cp)
... View more
01-23-2024
07:46 AM
|
1
|
1
|
226
|
POST
|
Ah, yes, good point! You would probably have to leverage the await operator.
... View more
01-18-2024
02:06 PM
|
0
|
0
|
449
|
POST
|
Are you sure they're in the right order when read into list_address and params?
... View more
01-18-2024
01:59 PM
|
0
|
1
|
453
|
Title | Kudos | Posted |
---|---|---|
4 | yesterday | |
1 | a week ago | |
1 | Friday | |
2 | a week ago | |
1 | a week ago |