|
POST
|
Hi All for the past 8 weeks i have been running a script that populates workforce with assignments from a csv published as a feature to ArcGIS online using python it worked every day until today when i was met with an error. strptime() argument 1 must be str, not int Failed to execute (Add Assignments) from datetime import datetime
#Append updated information
assignments = []
for feature in features:
assignments.append(
workforce.Assignment(
project,
geometry=feature.geometry,
location=feature.attributes["location"],
due_date=datetime.strptime(feature.attributes["Due_Date"], '%d/%m/%Y %H:%M:%S'),
description=feature.attributes["description"],
priority=2,
assignment_type=feature.attributes["AssignmentTXT"],
status="unassigned",
work_order_id=feature.attributes["WorkOrderReference"]
)
)
project.assignments.batch_add(assignments) the error is relating to the date field, i have changed nothing in my script. i uploaded the csv to Arcgis online published it as a feature and then used it to populate the assignments. Prior to this the due date was always recognized as a string but today Arcgis online recognized it as a date. Why would this suddenly start happening has something change with the way a csv is published to Arcgis online. i know i can just use the date field now but i am just curious as to why all of a sudden it changed.
... View more
05-29-2020
01:57 PM
|
0
|
7
|
2383
|
|
POST
|
Thanks Jeff i think i will try it on a current project we have in operation, we currently use the workforce module to automate the creation of assignments and i was looking for away to improve the content of the survey123 form so it was great to stumble across this info. Thanks for your reply.
... View more
05-29-2020
01:39 PM
|
0
|
0
|
1662
|
|
POST
|
Hi Aaron I am considering this as a solution to pass fields from workforce to survey123. I am just wondering if there was any pitfalls or risks associated with using it that you are aware of , as it is not fully supported via the workforce website.
... View more
05-20-2020
12:32 PM
|
0
|
4
|
3219
|
|
POST
|
I am experiencing the same thing as of yesterday scenarios that were working fine are now requesting re authorization almost every hour. Not sure if its linked to the webhook being triggered.
... View more
05-05-2020
06:34 AM
|
1
|
0
|
3048
|
|
POST
|
i have developed a model to download a layer from arcgis online every week and overwrite the GDB with the previous weeks information. I was then manually feeding this into a project and exporting a Map series for a weekly report. i decided to also try and automate this process so i could have reports generated automatically every week. i am a beginner at python and am self thought so please bear with me. my script is as follows which i developed in a notebook #!/usr/bin/env python
# coding: utf-8
# In[98]:
import arcpy
import os
import sys
aprx = arcpy.mp.ArcGISProject("CURRENT")
default = aprx.defaultGeodatabase
default
# In[116]:
import os
directory = 'C:\\Usersxxxxxxxxxxxxxx'
for filename in os.listdir(directory):
if filename.endswith(".gdb"):
print(directory+filename)
newGDB = directory+filename
newGDB
# In[117]:
newGDB
# In[101]:
aprx = arcpy.mp.ArcGISProject(r"C:\Users\xxxxxxxxxxx.aprx")
default = aprx.defaultGeodatabase
default
# In[60]:
import arcpy
aprx = arcpy.mp.ArcGISProject(r"C:\Users\xxxxxxx.aprx")
m = aprx.listMaps("Map")[0]
lyr = m.listLayers("Assignments")[0]
lyr.connectionProperties
# In[102]:
newCP={'dataset': 'Assignments',
'workspace_factory': 'File Geodatabase',
'connection_info': {'database': newGDB}}
newCP
# In[103]:
lyr.updateConnectionProperties(lyr.connectionProperties, newCP)
# In[104]:
lyr.connectionProperties
# In[105]:
tableAtt=m.listTables("Assignments__ATTACH")[0]
tableAtt.connectionProperties
# In[106]:
tableAtt.updateConnectionProperties(tableAtt.connectionProperties, newCP)
# In[107]:
tableAtt.connectionProperties
# In[108]:
tableGDBService=m.listTables("GDB_ServiceItems")[0]
tableGDBService.connectionProperties
# In[109]:
tableGDBService.updateConnectionProperties(tableGDBService.connectionProperties, newCP)
# In[110]:
tableGDBService.connectionProperties
# In[111]:
aprx.save()
# In[112]:
l = aprx.listLayouts()[0]
l
# In[113]:
import os
import sys
import datetime
from datetime import datetime
relpath = os.path.dirname(sys.argv[0])
printpath = r"T:\xxxxxxxxxxxxx"
str=current_time = datetime.today().strftime('%d-%m-%Y')
relpath
# In[114]:
aprx = arcpy.mp.ArcGISProject(r"xxxxxxxxxxx.aprx")
l = aprx.listLayouts()[0]
if not l.mapSeries is None:
ms = l.mapSeries
if ms.enabled:
ms = l.mapSeries
pagecount = ms.pageCount
indexLyr = ms.indexLayer
pagecount
# In[115]:
ms.exportToPDF(printpath+str,embed_fonts = True,resolution=400,georef_info=False,image_quality='FASTER',page_range_type = 'ALL',jpeg_compression_quality=25,output_as_image=False,layers_attributes='NONE',image_compression='ADAPTIVE')
# In[ ]:
it had work when i run it through the notebook but when i run it in a model in order to schedule it i am getting the following error. Traceback (most recent call last): File "C:\Users\xxxxxxxxxxxxxxxxx.tbx#ReplaceDSandPDF_ExcavationReports.py", line 50, in <module> IndexError: list index out of range Failed to execute (Replace DS and PDF). Any tips on where i am going wrong or even how to improve on my process are greatly appreciated.
... View more
03-20-2020
09:35 AM
|
0
|
1
|
1074
|
|
POST
|
Hi Chris you need to look at the json in your Body , you have a comma after your colon Object ID:, you need to remove it.
... View more
03-12-2020
01:32 AM
|
0
|
0
|
1776
|
|
POST
|
Hi Chris See below. you only need a header as per my screen shot then a post then for each object id in th e query you need to apply the edit as per below FYI i have migrated to integromat as i find it more user friendly.
... View more
03-03-2020
09:19 AM
|
0
|
1
|
1776
|
|
POST
|
Is there a way to update multiple workforce assignments from a csv using python. I have developed a notebook to add assignments from a csv based on this example however i will need it to update these assignments on a daily basis also with new information and geometry.
... View more
01-30-2020
06:12 AM
|
0
|
0
|
425
|
|
POST
|
Hi Daniel I am actually trying to accomplish the very same thing and i was wondering if you came up with a solution? I looked at the api documentation but it gives very little information. the documentation here refers to using batch methods but nothing specific to what i require either. Thanks Paul
... View more
01-30-2020
04:03 AM
|
0
|
1
|
1672
|
|
POST
|
Figured it out out_path=arcpy.GetParameterAsText(0)), then configure the parameter setting in the properties of the tool
... View more
11-20-2019
01:30 AM
|
0
|
0
|
694
|
|
POST
|
HI Ismael interested to know if this functionality was introduced and if there is any documentation available on it? Thanks
... View more
11-20-2019
12:45 AM
|
0
|
1
|
1071
|
|
POST
|
Hi All see below code which creates a replica of everything added to the layer in the last 7 days and saves to my drive. How do i set this FGDB as a output parameter to be used in model builder for further processing? from arcgis.gis import GIS from arcpy import env import arcgis.features gis = GIS("https://XXX.arcgis.com","XXX","XXX") url = 'https://services8.arcgis.com/XXX/arcgis/rest/services/XXX/FeatureServer' Digs = arcgis.features.FeatureLayerCollection(url, gis) Digs.properties.capabilities result = Digs.replicas.create(replica_name='Excavations', layers=[0], layer_queries = {"0":{"queryOption": "useFilter", "where": "CreationDate >= CURRENT_DATE-1"}}, return_attachments=True, attachments_sync_direction='bidirectional', wait=True, data_format="filegdb", asynchronous=True, out_path='T:\\GIS Files\\XXX') arcpy.SetParameter(1, result)
... View more
11-19-2019
04:19 AM
|
0
|
1
|
745
|
|
BLOG
|
i am using integromat to automate a pdf report and save to google drive Has anyone any success in changing the resolution of an image attached to a survey for inclusion in an pdf document. I want to capture a high resolution image but i want to reduce the file size of my document as it will quickly use my allowance in integromat.
... View more
11-18-2019
01:50 AM
|
0
|
0
|
28766
|
|
POST
|
Thanks Ismeal i want to be able to submit a location overview at a specific scale for each survey but it looks like this can only be done manually at the moment so. I think this may be a useful feature. I can think of a few applications myself i may log it as an idea.
... View more
11-18-2019
01:49 AM
|
1
|
0
|
2310
|
|
POST
|
Is it possible to default an annotate image question to the Map option? I want to have a image of the map attached to every form i submit
... View more
11-06-2019
04:38 AM
|
0
|
4
|
2673
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-27-2025 09:54 AM | |
| 2 | 08-27-2025 09:46 AM | |
| 11 | 05-06-2025 03:32 AM | |
| 1 | 03-30-2022 03:21 AM | |
| 1 | 05-03-2022 03:29 AM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|