|
BLOG
|
@WetherbeeDorshow So you would have a calculated expression against the CurrentDate field (unless you only want manual entry to permit backdating in the first instance. The below will return the date and time if the field is empty (feature creation). If it is not empty (editing) then it will retain the existing value: var cd = iif(isempty($feature.CurrentDate),$feature.CurrentDate,Now())
return cd Then use the below conditional statement for editing against the CurrentDate field (which you can create without needing to write arcade in the expression builder (though it formats it slightly differently): $feature.ChangeDate == "Yes" It is behaving a little unexpectedly in that when you change an edited values toggle back to "No", it reverts the CurrentDate field to todays date, but that might be fine for you (leaving the switch as "Yes"). Curious to see if anyone else has another solution. I can't seem to make it work around the issue above without the default date calculation failing to run until the toggle is switched to Yes then back to No when creating a feature. GIF below shows intended functionality plus bug at the end.
... View more
06-03-2024
04:35 PM
|
1
|
0
|
10820
|
|
BLOG
|
@LukeGilner1 I can definitely see use cases for this sort of logic in our workflows. I've already experimented with similar logic around creator name and current username. But being able to fill out the field automatically and then permit users to update it manually might be just the ticket I need for something I'm working on now.
... View more
05-30-2024
03:23 PM
|
0
|
0
|
10888
|
|
POST
|
Yep. Thats the setting I changed (screenshot was in the "before" state). I've logged this with Esri Support. I've gone through the survey xlsx with a fine tooth comb, fixed all warnings and errors and made sure it's the latest version with no joy. See if they can figure it out!
... View more
05-30-2024
01:20 AM
|
1
|
1
|
3749
|
|
POST
|
Thanks for pointing that out! That is a bit frustrating, but at least a simple fix....or at least I hoped it would be! I've updated the setting however, I still get the same error. In addition to the previouis GIF example, I can see the points in the map but can't select them (despite being an administrator).
... View more
05-29-2024
05:59 PM
|
0
|
3
|
3765
|
|
POST
|
Can anyone suggest how to fix this? Or is republish the only option? Tab ever so briefly loads the records then changes to show "Data error" with no records. The feature service was initially published as part of a Survey123 survey.
... View more
05-28-2024
05:48 PM
|
0
|
8
|
3829
|
|
POST
|
I won't say no to know more about how you've automated it. That bit still catches me out sometimes.
... View more
05-24-2024
03:49 PM
|
0
|
1
|
1360
|
|
IDEA
|
@Kyndabyt Yes, fair enough. It would do that still.
... View more
05-23-2024
08:08 PM
|
0
|
0
|
3322
|
|
POST
|
Hi @KerriRasmussen I have a followup question for you. Once you have set a vtpk as the offline basemap to be downloaded upon first use in Field Maps, is there anyway to trigger a replacement process in Field Maps without having to go map by map pointing them at a new package? All of my testing seems to indicate not. The tile layer replacement process updates the hosted tile layer, but not the underlying vtpk (correct me if I'm wrong). If we delete the vtpk and upload a new one with the same name, this fails as it has a different ItemID. Maybe it's possible to use python to script a method of searching for and replacing old ItemID's in the Offline basemap setting with a new ItemID? This could be done annually with a new basemap upload containing updated features (road networks and parcel boundaries for instance). We also experimented with the "Update Data" option on the Vector Tile Package item page, and this only updated the version of the vtpk on the mobile device after all offline areas had been removed and the app closed then a new area downloaded. It would be good if there was a way to push updates to these files through so that users could "optionally" download the latest version (prompted to download an update now or later). I also struggled to find any documentation around this Update Data function.
... View more
05-22-2024
09:18 PM
|
1
|
2
|
4560
|
|
IDEA
|
@MelanieWawryk You may also want to consider creating a custom role within your existing organisation which doesn't permit viewing of content shared to the organisation. This way you avoid needing a 2nd org but can restrict contractor users to only the groups they're a member of.
... View more
05-21-2024
07:29 AM
|
0
|
0
|
3359
|
|
IDEA
|
Our organisation is just starting to look at something like this too. One option is to get Contractors to pay for the licenses they need, but as you state, they aren't all tech savvy enough to run their own AGOL organisation. So that then leaves us as the intermediaries. I know it's possible to setup a user type (or Role?) that doesn't have access to content shared to the Org and instead only content shared to a group/s they're a member of. We would then be responsible for managing license acquisition and forwarding on charges associated to them. A solution like what you've proposed (single user license without attached organisation) that can be added to an organisations group would be a simpler way of allowing us to invite external members and handling license payments, however I can see where the issues still arise around account security settings, preferences, role types and all the flexibility that comes with the organisation settings.
... View more
05-19-2024
06:42 PM
|
0
|
0
|
3404
|
|
IDEA
|
When creating Hosted Views of feature services and enabling them for offline use in Field Maps, if you don't include the Editor and EditDate fields in the defined fields setting, then when offline and trying to submit edits, you receive an "Unable to submit" error (SQLite constraint violation.: SQLite: 19). I've made this error a couple of times over the years where I've either excluded or only included one of the 2 fields (intentionally, thinking that the user didn't need that info). And when this happens but you're working Online, it doesn't cause any issues. IDEA: When enabling the "Sync" option on a Hosted Views Settings page, automatically include the Editor and Edit Date fields in the define fields setting.
... View more
05-16-2024
06:47 PM
|
1
|
0
|
756
|
|
POST
|
For future reference, we abandoned this idea. Not sure if it was possible, but the amount of information that was to be passed over the URL in the form of vertice x and y coords was phenominal. So instead we cnow return a centroid of the selected shape, convert to Lat and Long and pass those across the URL for geopoint location. Works a treat 🙂
... View more
05-13-2024
11:16 PM
|
0
|
0
|
1033
|
|
POST
|
I'm having the same problem. Can call Survey123, pass attributes and centroid Lat/Long for geopoint creation, but upon returning to Field Maps, it just shows the popup. No edit pane or fields updated. Trying to update a field with the date and time that the survey happened via Now() in my Arcade URL generation .
... View more
05-13-2024
12:51 AM
|
0
|
0
|
3647
|
|
POST
|
Ok - thats interesting. I haven't seen any evidence of the curly brackets in my URL's when running my validation in the Arcade editors and copying the URL's in the browser.....BUT!......I've just reimplemented the original MID code and testing in Field Maps and it works! Turns out the app returns {a1b2c3-d4e5...} whereas in my web browser I was only seeing a1b2c3-d4e5... which when combined with the MID code would drop the first character (leaving me with 1b2c3-d4e5...). Lesson learnt - trust the code authors! At least I hope others can learn from my trials and tribulations documented here!
... View more
05-13-2024
12:45 AM
|
0
|
0
|
3419
|
|
POST
|
Post edited after I sorted out most of my own issues by undoing other supposed "fixes" (see comments above about the MID function and globalID's). I have managed to get my code working almost perfectly now. The only spot that I was getting stuck at and for which I've implemented a workaround, is passing back a date value to Field Maps instead of a text value to update the selected features attribute as done (instead of saying "Complete", it states when it was completed). Breif explanation of my code below, as I've extended it to use multiple fields from the source feature. The source (launching) feature in Field Maps has multiple fields which are checked to see at what "stage" an inspection process is up to (happens at various stages over 2 years). These are checked to find the first empty value and that is used to populate the type of inspection being done. This value is also used to then determine which date (now text) field should be edited upon callback to show that the corresponding inspection has been completed. The selected features centroid coordinates are also returned and converted into Lat/Long and passed as a parameter to Survey123 for the geopoint location. I couldn't for the life of me though figure out how to get the updateFeature section (Line 80) to work with a date value/field in Field Maps. I've change the fields to text and have now passed a string formatted as "my_username @ 2024-05-14 09:59 17.510" (Lines 45-47): Below is the full code I have implemented. // Calculate inspection number
var Inspection = IIF(IsEmpty($feature.insp_2_weeks)==True,"2 weeks",
IIF(IsEmpty($feature.insp_4_weeks)==True,"4 weeks",
IIF(IsEmpty($feature.insp_6_weeks)==True,"6 weeks",
IIF(IsEmpty($feature.insp_8_weeks)==True,"8 weeks",
IIF(IsEmpty($feature.insp_10_weeks)==True,"10 weeks",
IIF(IsEmpty($feature.insp_12_weeks)==True,"12 weeks",
IIF(IsEmpty($feature.insp_4_months)==True,"4 months",
IIF(IsEmpty($feature.insp_5_months)==True,"5 months",
IIF(IsEmpty($feature.insp_6_months)==True,"6 months",
IIF(IsEmpty($feature.insp_9_months)==True,"9 months",
IIF(IsEmpty($feature.insp_12_months)==True,"12 months",
IIF(IsEmpty($feature.insp_15_months)==True,"15 months",
IIF(IsEmpty($feature.insp_18_months)==True,"18 months",
IIF(IsEmpty($feature.insp_21_months)==True,"21 months","24 months"))))))))))))))
// Get matching inspection number field name
var InspFieldName = IIF(Inspection=="2 weeks","insp_2_weeks",
IIF(Inspection=="4 weeks","insp_4_weeks",
IIF(Inspection=="6 weeks","insp_6_weeks",
IIF(Inspection=="8 weeks","insp_8_weeks",
IIF(Inspection=="10 weeks","insp_10_weeks",
IIF(Inspection=="12 weeks","insp_12_weeks",
IIF(Inspection=="4 months","insp_4_months",
IIF(Inspection=="5 months","insp_5_months",
IIF(Inspection=="6 months","insp_6_months",
IIF(Inspection=="9 months","insp_9_months",
IIF(Inspection=="12 months","insp_12_months",
IIF(Inspection=="15 months","insp_15_months",
IIF(Inspection=="18 months","insp_18_months",
IIF(Inspection=="21 months","insp_21_months","insp_24_months"))))))))))))))
// Get centroid Lat and Long
var originShift = 2.0 * PI * 6378137.0 / 2.0;
var lon = (Centroid($feature).X / originShift) * 180.0;
var lat = (Centroid($feature).Y / originShift) * 180.0;
lat = 180.0 / PI * (2.0 * Atan( Exp(lat * PI / 180.0)) - PI / 2.0);
// Generate callback attribute
var user = GetUser($layer).username
var date = left(Date(),10)
var cbvalue = user + " on " + date
// Source: https://community.esri.com/t5/arcgis-survey123-questions/help-with-survey123-link-from-field-maps-with/td-p/1306591
// To launch survey123 from map
// EDIT THIS LINK TO MATCH YOUR SURVEY LINK (Only edit AFTER itemID= and BEFORE &
var urlsource ="arcgis-survey123://?itemID=b40c1e4d99084cbca8170ff273c74977&"
//Format globalid to "link" survey point to map data -- MUST have globalid field for this script to work. DO NOT EDIT THIS LINE
var fglobalid = Mid($feature.GlobalID, 1,36)
//Generate other url parameters to pass to survey123. -- These are the values you wish to transfer from Field Maps to your Survey123 form.
// Edit or delete fields as necessary. The line containing $feature.GlobalID MUST NOT BE REMOVED, but the field to the left of $feature.GlobalID may
// be changed to reflect the field in your Survey to store the GlobalID.
var params = {
"field:plantation": $feature.Plantation,
"field:years_planted": $feature.PlantingYear,
"field:tree_species": $feature.Species,
"field:tenure": $feature.RENDER_LABEL,
"field:inspection_number": Inspection,
};
// Get map center coordinates
var center = concatenate([lat,lon],",")
// Create callback portion of link using itemID (map ID) and featureSourceURL (services link to the layer containing the feature to be edited following survey submission)
// EDIT THIS LINK FOR MAP AND FEATURE SERVICE. updateFeature&itemID=<your maps ID>&featureSourceURL=<link to the feature class to be edited>
var callback = {
callback:"https://fieldmaps.arcgis.app/?referenceContext=updateFeature&itemID=##############&featureSourceURL=https://services3.arcgis.com/############/arcgis/rest/services/#################/FeatureServer/0",
//var callback = {callback:"https://fieldmaps.arcgis.app",
}
// // Add featureID (must be var fglobalid) portion of callback link
// THIS LINE MUST NOT BE CHANGED. This line is what tells the script which point in the feature class will be edited
var callbackid = "featureID=" + fglobalid
var callbackattribute = 'featureAttributes={"' + InspFieldName + '":"' + cbvalue + '"}'
// Return the entire link/URL. This is what the FieldMaps app is following when you click the link to enter survey data. This should not be changed unless there is no callback
// attribute to pass back to Field Maps
/// return urlsource + UrlEncode(params) + "&" + UrlEncode(callback) + "%26" + UrlEncode(callbackid) + "%26" + UrlEncode(callbackattribute)
return urlsource + UrlEncode(params) + "¢er=" + UrlEncode(center) + "&" + UrlEncode(callback) + "%26" + UrlEncode(callbackid) + "%26" + UrlEncode(callbackattribute)
// For use in the pop-up for your featureclass, simply enter the expression name in the link field (i.e. {expression/expr0})
... View more
05-12-2024
09:47 PM
|
0
|
0
|
716
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | a week ago | |
| 2 | 2 weeks ago | |
| 4 | 2 weeks ago | |
| 1 | 2 weeks ago | |
| 2 | 3 weeks ago |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|