|
POST
|
Hi Kim, The new "Form" functionality in Map Viewer and Field Maps allows you to have a calculation using Arcade. I've done something similar and I believe my steps were something along the lines of: Intersect the current feature with your overlay layer, indicating which side of town it's in https://developers.arcgis.com/arcade/function-reference/featureset_functions/#intersects Get the layer to query itself (filter function https://developers.arcgis.com/arcade/function-reference/featureset_functions/#filter) to find records with an "S" or "N" in the AssetID field, then use Order By (filtered features, "AssetID Desc") to get the one with the highest number at the top, and First(OrderedFeatures) to get the top one Grab the final four characters of the id by doing Right(FirstFeature.AssetID, 4) , then cast it to a number by using Number(RightFeature) Get the next number by doing += 1 on the above number Add the leading zeroes by taking your number and doing Text(mynum, "0000") Concatenate "VALV-" + the N/S string + "-" + the number with the padded zeroes from the step above This will then work in that web map or field maps app. Not quite the same as using attribute rules but the best way I've found of doing it in AGOL so far, hope that helps!
... View more
04-05-2023
11:09 PM
|
1
|
4
|
5804
|
|
POST
|
Do you want to do the selection in ArcPy as well or will you be selecting them using the regular tools in the GUI and then running some python to create the layer? This page https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/make-feature-layer.htm has the details of the make feature layer tool which is what you want, just click on "Python" in the Parameters section to see what the function is + what the inputs are. Pretty sure that by default if your input features into the tool have a selection on them that that will be honoured in any ArcPy tool.
... View more
04-05-2023
10:45 PM
|
0
|
9
|
11338
|
|
POST
|
Hi Aurelian, Unless I'm misunderstanding I think you might be over-complicating things. When adding the indicator widget you're able to add a filter (in this case FREQ_MAINTENANCE not equal 0) and choose the statistic as "SUM" on "Shape_Length". Cheers, Josh
... View more
04-03-2023
02:33 AM
|
0
|
0
|
780
|
|
POST
|
Hi, I believe this support article shows an example of what you're trying to do: https://support.esri.com/en-us/knowledge-base/how-to-show-attachments-from-a-related-tablelayer-in-t-000027210 pulling the images from a related table onto the parent features popup. In this example it only returns the first image, but I think the code could be modified to return all images.
... View more
04-01-2023
03:50 PM
|
0
|
0
|
827
|
|
POST
|
Hi Aurelian, I think it'd work if you just flipped the first two lines, filtering the $feature.FREQ_ENTRETIEN !=0 values out before you sum them. Just make sure to then put the filter variable into the sum function instead of $layer. Cheers, Josh
... View more
04-01-2023
03:34 PM
|
0
|
0
|
2169
|
|
POST
|
Yeah getting the query right is often difficult in my experience. You might want to bring "item_type" out of the query and just add it to the gis.content.search() parameters to remove one of the potential variables that could be going wrong. I'd also try to just print out that query to make sure the string is being formatted correctly, at a glance I'm not sure the "" around the owner:username section is right as it doesn't seem to match the query examples on the API reference page. If you are still struggling you could fetch a list of your items by using user.items() instead, although that is less ideal.
... View more
02-06-2023
08:56 PM
|
0
|
0
|
2108
|
|
POST
|
Hi Christopher, I believe the grid form layout isn't supported in the web currently, as per this previous community thread https://community.esri.com/t5/arcgis-survey123-questions/grid-theme-in-survey123-web-app/td-p/1102662
... View more
02-03-2023
08:42 PM
|
0
|
0
|
576
|
|
POST
|
You should be able to pull the current year by using format-date(now(), "%Y"), so if your month-date calculation was working correctly you might be able to add a calculation that checks that the input year is equal to the above value? That being said I can't work out how to put that logic within a constraint on the date field itself, instead having it as a text or note (no field created in resulting service, so cleanest option) field underneath. Like so And you could add a constraint message saying "Date not within current year" so users would know why it failed. Not sure if this is the most efficient way of doing it but it would work, hope that helps!
... View more
02-03-2023
08:07 PM
|
0
|
0
|
579
|
|
POST
|
Hi, Not sure quite why it wouldn't be working for you, looks pretty good to me, but to help you debugging have you tried hovering over the links in the popup in your webmap to see what the resulting urls look like? You can copy the link that is being output by the script for one of the features that's working and for the feature that isn't working and compare the two, which has helped me diagnose issues with Survey123 urls in the past. The only difference between the two expressions that stands out to me is the SQL query for Spray Information which would probably be a prime candidate for being broken by apostrophes, although not 100% why it would work for other features with apostrophes.
... View more
02-03-2023
04:55 PM
|
0
|
0
|
903
|
|
POST
|
I'd start by putting some print statements in there and making sure the two functions you've defined actually work independently as you're intending them to work. Also when initiating a list (line 9) you don't need the "", just do []. Are your feature classes all within feature datasets in your geodatabase? Because if not I don't think the FCIterator would return anything. Also out of curiosity how many layers are you wanting to update in AGOL via this script? If it's fewer than 20 it may be simpler to just create a dictionary of fc names and associated AGOL itemID's to avoid relying on the gis.content.search query return the correct item as in my experience it doesn't always return what you would expect.
... View more
02-03-2023
04:36 PM
|
0
|
2
|
2165
|
|
POST
|
I was going to suggest accessing it via the roleId, if we can get that to work! It should just be searched_role.name to return the role name once you have the role object!
... View more
12-22-2022
12:06 PM
|
0
|
0
|
7116
|
|
POST
|
As I think it's more reliable that way. I'm also not 100% sure you can query a webmap on its layers using the gis.content.search function. I wrote some code to search webmaps for all services in a portal/agol instance to find services that were unused, which you can find here https://github.com/joshsharpheward/gis-administration/blob/master/find_unused_services.py which I think you could modify to do what you need or at least use for inspiration!
... View more
12-21-2022
06:36 PM
|
2
|
3
|
4492
|
|
POST
|
When I print out a list of user roles using user.role it only shows org_user/org_admin where the default "User" and "Admin" roles are being used, and for all of our custom roles it is printing the name correctly. Are you running this from a notebook in ArcGIS Online? And I'm assuming you've gone through the full list of user roles that have been output in your csv and confirmed that there's nothing other than org_user/org_admin/org_viewer?
... View more
12-21-2022
06:07 PM
|
0
|
4
|
7123
|
|
POST
|
Hi, Doing this in field calculator is definitely the best option! Is the AccountID field a text field? Because if it's an integer field you won't be able to add zeros onto the front, and in that case you would need to add a text field to calculate the values into. As for some code to do what you're trying to do, if you put this in the code block using Python3: def addZeros(ID):
ID = str(ID)
noZeros = 10 - len(ID)
return "0" * noZeros + ID and then the following as the python expression to run above the code block box addZeros(!IDNum!) With the !IDNum! being the Account ID field, that should do what you're after! Cheers, Josh
... View more
12-21-2022
01:53 PM
|
1
|
1
|
1783
|
|
POST
|
Hi, You can loop through all of the webmaps in your arcgis online by using the following code: web_maps = gis.content.search(query="", item_type="Web Map", max_items=10000)
for item in web_maps:
wm = WebMap(item) Then use the rest of the code that you have been using! If you have any issues you can refer back to this code in github that I put together which searches through web maps for a particular web service https://github.com/joshsharpheward/gis-administration/blob/master/search_webmaps_for_services.py Cheers, Josh
... View more
12-20-2022
07:14 PM
|
0
|
0
|
1717
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-22-2023 10:37 PM | |
| 1 | 04-05-2023 11:09 PM | |
| 1 | 05-21-2024 10:26 PM | |
| 1 | 04-20-2023 12:05 AM | |
| 1 | 05-21-2023 10:47 PM |
| Online Status |
Offline
|
| Date Last Visited |
03-20-2025
08:52 AM
|