|
POST
|
Hi - I'm hoping for some help with my syntax. The first part of this expression is working well. I can not figure out where I am going wrong starting at line 105 with the Clip function. I've verified everything above this is working thru use of Console, but can't get any further. I am wondering if because I am trying to feed Clip a FeatureSet instead of a $feature (as shown in the documentation) I am getting an error. Do any of the Arcade wizards on here have suggestions? @jcarlson @XanderBakker @JohannesLindner The goal here is to use Dashboards/Arcade to provide non-GIS people with information needed for reporting w/o having to open Pro and do geoprocessing, or without needing a Creator license to use the AGOL Spatial Analysis tools. I was hoping this might be a viable workaround. Thank you! // custom memorize function to increase performance of featureset
function Memorize(fs) {
var temp_dict = {
fields: Schema(fs)['fields'],
geometryType: Schema(fs).geometryType,
features: []
}
for (var f in fs) {
var attrs = {}
for (var attr in f) {
attrs[attr] = Iif(TypeOf(f[attr]) == 'Date', Number(f[attr]), f[attr])
}
Push(
temp_dict['features'],
{attributes: attrs, geometry: Geometry(f)}
)
}
return FeatureSet(Text(temp_dict))
}
// variable to define the portal URL
var portal = Portal("https://mass-eoeea.maps.arcgis.com");
// Quabbin Drainage Basins
var QUAB = FeatureSetByPortalItem(portal, "6b878308af9646af8239d2251a26fe15", 0, ['DISTRICT', 'SUB_BASIN', 'AREA_ACRES'], true);
// Ware River Drainage Basins
var WARE = FeatureSetByPortalItem(portal, "60c237cb9b53472a91c331785c035954", 0, ['DISTRICT', 'SUBDISTRICT_BASIN', 'Acres'], true);
// Wachusett Subbasins
var WACH = FeatureSetByPortalItem(portal, "702f5bf477d7451aa27abc939c9b5b65", 0, ['Big_Wshed', 'Wshed', 'Area_Acres'], true);
// Create a FeatureSet with all Basins from Quabbin, Ware and Wachusett
var int_dict = {
fields: [
{name: "DistrictName", type: "esriFieldTypeString"},
{name: "BasinName", type: "esriFieldTypeString"},
{name: "Acres", type: "esriFieldTypeDouble"},
],
geometryType: "esriGeometryPolygon",
"spatialReference": {
"wkid":102100,
"latestWkid": 3857
},
features: [],
};
// Fill intermediate FeatureSet with Basin Info
var i = 0;
for (var q in QUAB) {
//Console(q)
int_dict.features[i] = {
attributes: {
'DistrictName': q["DISTRICT"],
'BasinName': q["SUB_BASIN"],
'Acres': q["AREA_ACRES"],
},
geometry: Geometry(q),
}
i++;
};
for (var w in WACH) {
int_dict.features[i] = {
attributes: {
'DistrictName': w["Big_Wshed"],
'BasinName': w["Wshed"],
'Acres': w["Area_Acres"],
},
geometry: Geometry(w),
}
i++;
};
for (var r in WARE) {
int_dict.features[i] = {
attributes: {
'DistrictName': r["DISTRICT"],
'BasinName': r["SUBDISTRICT_BASIN"],
'Acres': r["Acres"],
},
geometry: Geometry(r),
}
i++;
};
//Console(Text(int_dict));
//return FeatureSet(Text(int_dict));
var basinDict = FeatureSet(Text(int_dict));
//Console(Text(basinDict));
// DWSP Fee OpenSpace
var dwspOS = Memorize(Filter(FeatureSetByPortalItem(portal, "807b0f1e96444ec28fd06270fb8d3488", 0, ['GIS_ACRES'], true), "OWNER_ABRV ='DCRW'"))
// create an empty feature array
var features = []
// clip dwspOS by int_dict features to determine number acres dwspOS per basin
for (var b in basinDict) {
// get the envelope of each basin feature within int_dict
var envelope = Extent(b)
// determine acres per envelope (basin)
// is clip function limited to working with a single feature rather than a collection of features?
var areaOS = Area(Clip(Geometry(dwspOS), envelope), 'acres')
Console(areaOS)
for (var a in areaOS) {
// do math to determine percent ownership dwspOS acres per basin
var pctOwn = Round(a/basinDict.Acres*100, 1)
//add to array
var new_f = {attributes: {
DistName: a[basinDict.DistrictName],
Basin: a[basinDict.BasinName],
AcresBasin: a[basinDict.Acres],
AcresDWSP: areaOS,
PctOwnership: pctOwn,
}}
Push(features, new_f)
}
}
Console(Text(new_f));
// create a FeatureSet with all of these features
var combined_dict = {
fields: [
{name: "DistName", type: "esriFieldTypeString"},
{name: "Basin", type: "esriFieldTypeString"},
{name: "AcresBasin", type: "esriFieldTypeDouble"},
{name: "AcresDWSP", type: "esriFieldTypeDouble"},
{name: "PctOwnership", type: "esriFieldTypeDouble"},
],
geometryType: "esriGeometryPolygon",
"spatialReference": {
"wkid":102100,
"latestWkid": 3857
},
features: features,
}
//Console(Text(combined_dict));
//return FeatureSet(Text(combined_dict));
return combined_dict
... View more
12-14-2023
08:06 AM
|
0
|
0
|
991
|
|
POST
|
@DominicRobergeIADOT that was so helpful! Thank you for those detailed images and also your patience with me! Here was what I ended up doing: div(sub(ticks(addDays(body('Convert_Inspection_Date'),int(items('Apply_to_each')?['Attributes/PHASE_I_INTERVAL']),'yyyy/MM/ddTHH:mm:ss')),ticks('1970-01-01Z00:00:00')),10000) Instead of adding a second Compose, I just updated my original Compose which was using the "addDays" function and nested that inside your EPOCH conversion. The I used outputs from Compose within my ArcGIS "Update a record in a feature layer". It worked perfectly when I tested! Thank you so much!
... View more
12-13-2023
12:47 PM
|
1
|
0
|
4907
|
|
POST
|
@DominicRobergeIADOT @SeanKMcGinnis Thanks for the suggestion. When I try either of these in a new Compose, I get "Invalid statement" and can't apply the expression: div(sub(ticks(outputs('Get_Phase_1_Inspection_Interval_from_Feature_Layer')?['body/data'],ticks('1970-01-01Z00:00:00')),10000) div(sub(ticks(outputs('Compose'),ticks('1970-01-01Z00:00:00')),10000)
... View more
12-13-2023
09:49 AM
|
0
|
2
|
4911
|
|
POST
|
@DominicRobergeIADOT @SeanKMcGinnis - Sure, here are the outputs. First is that output from ArcGIS Connector "Get Phase 1 Inspection Interval from Feature Layer". {
"statusCode": 200,
"headers": {
"offset": 1,
"hasMoreData": "no",
"Timing-Allow-Origin": "*",
"x-ms-apihub-cached-response": "false",
"x-ms-apihub-obo": "false",
"Date": "Mon, 11 Dec 2023 20:38:00 GMT",
"ETag": "W/\"342-jBGiEo2buRqe7BgtiCHbyLsmGbM\"",
"X-Powered-By": "Express",
"Content-Length": "834",
"Content-Type": "application/json; charset=utf-8"
},
"body": {
"data": [
{
"attributes": {
"OBJECTID": 45,
"NAT_ID": "MA99999",
"DAM_NAME": "Erica's Dam",
"DAM_LOCATION": "Hubbardston",
"DAM_TYPE": "Concrete",
"DAM_OTH": null,
"YEAR_BUILT": 2500,
"WATERSHED": "Quabbin",
"OWNER": null,
"CARETAKER": null,
"JURISDICTIONAL": "Y",
"PHASE_I_INTERVAL": 730,
"LAST_PHASE_I": 1639242000000,
"SCHED_PHASE_I_INSPEC": 1702314000000,
"SIZE_CLASS": "Small",
"HAZARD_CLASS": "Class I",
"HEIGHT_FT": null,
"LENGTH_FT": null,
"CAPACITY_AcFt": null,
"CREST_ELEV_FT": null,
"SPILLWAY_ELEV_FT": null,
"SPILLWAY_WIDTH_FT": null,
"ELEV_REFERENCE": null,
"OUTLET_TYPE": null,
"ROUTINE_INSPEC_INTERVAL": null,
"LAST_ROUTINE_INSPEC": null,
"ADD_COMMENTS": "TEST ONLY ERICA WILL DELETE WHEN DONE",
"DAM_FILES": null,
"GlobalID": "24b4e810-f399-4146-88cd-919c82b2a459",
"CreationDate": 1702320093451,
"Creator": "DWSP_erica.tefft",
"EditDate": 1702320597270,
"Editor": "DWSP_erica.tefft"
}
}
]
}
} Next, here is the output from "Compose": "2025/12/10T18:47:00" Please let me know if that helps/is what you were looking for. Thank you for your help!
... View more
12-12-2023
12:38 PM
|
0
|
4
|
4918
|
|
POST
|
@DominicRobergeIADOT @SeanKMcGinnis - This is, I think, exactly what I need, however I am having a hard time applying it. Would either of you be able to help? The initial trigger of this flow is a Survey123 submission. When certain criteria are met, then I get the matching parent record from a feature layer and convert the inspection date from the Survey123 form. Syntax for this conversion is working well: addSeconds('1970-1-1', Div(triggerBody()?['feature']?['attributes']?['INSPEC_DATE'], 1000), 'yyyy/MM/ddTHH:mm:ss') I then use Compose to addDays to my converted dateTime. I am getting the interval from my feature layer. Again, this is workign well: addDays(body('Convert_Inspection_Date'),int(items('Apply_to_each')?['Attributes/PHASE_I_INTERVAL']),'yyyy/MM/ddTHH:mm:ss') I was initially trying to write the outputs from Compose directly to my date attribute field in the bottom "update a record in a feature layer", however I am getting an error when I try this. I stumbled across this post and I think the conversion back to Epoch time is exactly what I need, but can't get it to implement. Here is what I am trying: div(sub(ticks(outputs('Compose')?['body/Compose']),ticks('1970-01-01Z00:00:00')),10000) This results in this error: InvalidTemplate. Unable to process template language expressions in action 'Update_a_record_in_a_feature_layer' inputs at line '0' and column '0': 'The template language expression 'div(sub(ticks(outputs('Compose')?['body/Compose']),ticks('1970-01-01Z00:00:00')),10000)' cannot be evaluated because property 'body/Compose' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'. Any advice? Thank you,
... View more
12-11-2023
12:48 PM
|
0
|
6
|
4924
|
|
BLOG
|
@SeanKMcGinnis I think the community would greatly benefit from some sort of blog to walk them thru how to set up what you've described above. I certainly know I would need some step-by-step guidance to configure such a flow.
... View more
11-28-2023
10:16 AM
|
2
|
0
|
5809
|
|
BLOG
|
@TL2 - could you share a screen capture of this flow? I'd be very interested in setting something similar up. This continues to be a massive pain point of using this technology. I have reminders all over the place to check tokens, but it seems like the length keeps changing!
... View more
11-28-2023
07:18 AM
|
0
|
0
|
5837
|
|
BLOG
|
Hi @AnthonyLatini @SeanKMcGinnis - Can I get some confirmation here on token life - above it seems to be saying 90 days, which I thought was the case for GCC. I'm having some issues with my flows using the ArcGIS connector failing due to authentication issues well before their 90 days is up. Can you please share any insights here? Thank you, Erica
... View more
11-28-2023
07:09 AM
|
1
|
0
|
5851
|
|
POST
|
Hi - I am developing a summary report and running into an issue. After re-reading the tricks of the trade blog about summary reports, I am confused about the behavior I am experiencing. It seems as if filtering and aggregate functions within a summary report should honor the selected records from the Survey123 website when generating a report, unless the !important parameter is used. So far, most of my summary report is working properly and returning what I'd expect. I have a table w/ aggregate functions that is returning responses based on the entire hosted feature layer instead of on the selection made in the Survey123 website. I am wondering if this is expected behavior, or if I have done something wrong with my syntax. Here is the summary section causing issues (full template attached): ** Update: The problem appears to be an issue in multiple sections of the template - namely "Inspection Conditions" and the last section "Details...". In both instances, the counts returned are for all records for each CGP File Number, instead of only the remaining records after Filtering and selections are made on the Survey123 website. In the Survey123 website, I have 9 parent records selected; I've checked and all repeat records have been properly filtered based on the selection. When I generate a preview report, instead of getting the above information for each of the 9 selected records, I get it for every CGP File Number in the hosted feature layer if the 'where' clause has been met. Can anyone provide advice on why this is? Is this expected behavior? Here are the Filters applied on the Survey123 website: This narrows me down to 195 Site Visit Inspections that meet this criteria (and are associated with the 9 parent files), however the total number of Site Visit Inspections for these 9 parent files is being included in the report (673). Thank you,
... View more
09-13-2023
08:53 AM
|
0
|
0
|
1214
|
|
POST
|
I've spent the last week or so performing various tests with Esri Technical Support; it appears that somehow this Survey123 form item in AGOL or the XLSForm itself became corrupted. The solution was to create a brand new Survey123 form and to publish that from the most recent version of Connect. I'd been trying to avoid this as this form is embedded in an Experience Builder app for data entry and has multiple webhooks associated with it, but this seemed like the only option and worked to resolve the issue
... View more
09-13-2023
08:28 AM
|
0
|
0
|
1711
|
|
POST
|
Hi @ZacharySutherby , No, that option is enabled. Thanks,
... View more
09-06-2023
04:56 AM
|
0
|
0
|
1740
|
|
POST
|
Hi - I made a very minor change to an established Survey123 form by updating the label for a question in the form. I republished from Survey123 Connect version 3.18.123. This form is used as a web form, and when my user checked again, the label was not changed. I downloaded Survey123 Connect version 3.18.124 and tried to republish again - same thing, the change was not honored in the web form. I then opened the Survey123 form in the mobile app on my iPhone (app version 3.18.145) and the change was present in the mobile version of the form. This seems to be a bug and I will open a case with Esri Tech Support, but also wanted to ping @IsmaelChivite w/ this info. Thank you,
... View more
08-31-2023
05:32 AM
|
0
|
3
|
1867
|
|
POST
|
Using pulldata("@layer") works well to solve this issue, however I still think this could use some finessing from the Survey123 team to make this work without pulldata... Some cleaning up needed, but as a proof of concept, this supports Workflow A above, which is what I was hoping for as I need to support reinspection of assets with extremely long inspection forms.
... View more
08-28-2023
08:21 AM
|
0
|
0
|
2704
|
|
POST
|
Hi Josh, We use the Field Maps solution for many of our inspection workflows, and it's great, however this survey is extremely long and detailed. It would just not be possible to use this for this situation. I actually thought of pulldata last Friday and plan on trying it this week. I think that will work and might be the best option for grabbing the proper GlobalID and writing it to my "dam_guid" field to solidify the relationship. @IsmaelChivite It would be great if it was possible, within a repeat, to view the most recent repeat record and just copy that to a new/editable repeat record and use that to edit the inspection form (Workflow B above).
... View more
08-28-2023
06:48 AM
|
0
|
0
|
2708
|
|
IDEA
|
I agree that if the data is shared with you in a group, any group member regardless of user type, should be able to download the data to use locally. This should NEVER require a Creator-level account.
... View more
08-28-2023
06:42 AM
|
0
|
0
|
5084
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | Tuesday | |
| 1 | 09-06-2022 09:14 AM | |
| 6 | 10-24-2024 12:04 PM | |
| 1 | 04-28-2021 09:14 AM | |
| 3 | 09-06-2022 11:53 AM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|