|
POST
|
Thank you both for your replies. I have a field of the type text that has profile numbers which can be 1, 2, 3 but also 2a, 2b, 2c, etc. that's why I store them as text. My script worked before for one file with 1, 2, 3b, 4, 5b, 6, 7, 8 so I guess it is working as long there is only once the number with a letter but not if the same number has many letters. The script works when I just leave away the "sorted". Thanks!
... View more
03-07-2019
10:25 PM
|
0
|
0
|
2072
|
|
POST
|
I have a python script that is supposed to return a unique value of a field. def unique_values(table, field):
with arcpy.da.SearchCursor(table, [field]) as cursor:
return sorted({row[0] for row in cursor}) That works also very fine as long as the values are only numbers. Somehow when values contain also text then it only returns the values that are numbers not the text ones. I don't see why. I'm using python 2.7 with ArcGIS 10.6.1.
... View more
03-07-2019
04:47 AM
|
0
|
7
|
2242
|
|
POST
|
When I look through my content in AGO assistant or with the Python API for ArcGIS for example, I find a couple of files of the type "Code Attachment". When I look into the item details I can't find any valuable information. For what are these files needed?
... View more
03-06-2019
02:04 AM
|
0
|
17
|
15968
|
|
POST
|
I tried item.url but I get "none" as response. Ah, yes "yoursharingurl" makes sense pluse item id + /data. That was easier than I thought: folderitems = me.items(folder)
for item in folderitems:
print(str(item.title)+" url: <yoururl>sharing/rest/content/items/" + str(item.id) + "/data")
... View more
02-27-2019
11:24 AM
|
3
|
0
|
1869
|
|
POST
|
I am looking for a way to get a list of my items (images) with the corresponding sharing URL. I know how to get a list of my items but I don't find (if there is) the right property of the item to get that URL. (I am looking for the one that you find at the lower right of the item's details page.) Thanks for hints!
... View more
02-27-2019
08:43 AM
|
2
|
2
|
2120
|
|
POST
|
As far as I can see, yes. I added this to have all selected: self.params[3].value=self.params[1].filter.list after your line 79. I also had to add another loop to go through all tables in the folder. It turned out (in contrast to what I thought) that not all tables have data for the same indicators... This is my updated validation code. Note, that I have params[3] in the end... Ah, yes, and I added a lower case sort of the field names. def updateParameters(self):
"""Modify the values and properties of parameters before internal
validation is performed. This method is called whenever a parameter
has been changed."""
filedir=self.params[0].value
if filedir:
arcpy.env.workspace = filedir
list_of_files = arcpy.ListFiles("*.txt")
firsttable=list_of_files[0]
for txtfile in list_of_files:
complete_filename = str(filedir)+"\\"+str(txtfile)
table=arcpy.MakeTableView_management(complete_filename, "kivu_tview")
desc = arcpy.Describe(table)
arcpy.AddMessage("Table to be analyzed: "+str(table))
fieldselectlist=[] #Will collect the field names
for ofields in desc.fields:
ftype=ofields.type
fname=ofields.name.encode("utf-8")
if ftype in ["Double","Long"]:
#print(fname)
if fname not in ["Profile_No","Longitude (degrees_east)" ,"Latitude (degrees_north)" ,"Bot. Depth (m)","Depth (m)","Depth (0.5 m )" ,"Depth (0.5 m)","Distance from platform","Time (actual)"]:
with arcpy.da.SearchCursor(table, fname) as calcursor:
for calcrow in calcursor:
if calcrow[0] is not None:
if calcrow[0] not in fieldselectlist:
fieldselectlist.append(fname)
break
arcpy.AddMessage(fieldselectlist)
arcpy.Delete_management("kivu_tview","Table View") # delete table view
#sorted_list=fieldselectlist.sort(key=str.lower)
#sorted_list=fieldselectlist.sort(key=lambda x:x.lower())
if 'pH' in fieldselectlist and 'pH corrected' in fieldselectlist:
fieldselectlist.remove('pH')
if 'Dissolved Oxygen (mg/L)' in fieldselectlist and 'Dissolved Oxygen corrected (mg/L)' in fieldselectlist:
fieldselectlist.remove('Dissolved Oxygen (mg/L)')
sorted_list_not_cs=sorted(fieldselectlist,key=str.lower)
arcpy.AddMessage("sortiert, not case sensitive: "+str(sorted_list_not_cs))
# for multiple choice
try:
if self.params[3].values: #if this parameter has seleted values
oldValues = self.params[3].values #set old values to the selected values
except Exception:
pass
self.params[3].filter.list = sorted_list_not_cs #set the filter list equal to the sorted values
newValues = self.params[3].filter.list
self.params[3].value=self.params[3].filter.list
try:
if len(oldValues): # if some values are selected
self.params[3].values = [v for v in oldValues if v in newValues] # check if seleted values in new list,
# if yes, retain the seletion.
except Exception:
pass
#self.params[3].filter.list=sorted(fieldselectlist)
return
... View more
02-25-2019
12:07 PM
|
0
|
0
|
1115
|
|
POST
|
We have a project where researchers would get access to certain data on request and for a limited time. Is there a way to limit the "lifespan" of a member? Let's say, I grant someone access today and want to remove him as a user again after 30 days. Is there a way to automatize this or would I need to put a reminder in my calendar?
... View more
02-25-2019
05:12 AM
|
0
|
2
|
739
|
|
POST
|
Is there a way to enable the "Select all/unselect all" functionality for the tool? I was able to "select all" after loading the list through the validator but the buttons inside the tool don't work. I guess that would another "on change" event but how do I catch that?
... View more
02-25-2019
05:01 AM
|
0
|
4
|
1115
|
|
POST
|
Haha, yes, either or Well, just when I was trying to summarize for support what does not work I thought "maybe I have to relate my tables again to make that work" et voilà: It works. I would still think that having a relationship class should do the job but it doesn't...
... View more
02-24-2019
02:14 PM
|
1
|
0
|
1809
|
|
POST
|
Maybe it was already too late when I was wondering about this. I just saw that in the Query Widget settings in the Info section you can very well put an customized name to label the query and the output. Don't know why I haven't seen that before...
... View more
02-24-2019
02:12 PM
|
1
|
0
|
698
|
|
POST
|
Well, I used the create Attachments option in the context menu of the feature class. That creates the attachment table and the attachment relationship class. The attachments themselves are created and attached through a python script. When I do the same (step by step) through the toolbox I end up with the same result. I can see the attachments with the identify tool but I cannot access them through the related table in the attribute table. That can't be wanted...
... View more
02-24-2019
12:05 PM
|
0
|
2
|
1809
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-09-2023 03:26 AM | |
| 1 | 02-13-2019 01:51 AM | |
| 1 | 04-03-2025 11:07 AM | |
| 1 | 01-14-2024 01:34 PM | |
| 1 | 10-01-2018 10:23 PM |
| Online Status |
Offline
|
| Date Last Visited |
Friday
|