|
POST
|
Hi, I have a data expression (below) which executed properly when I was testing the data expression and configuring my chart in my Dashboard. After I saved and refreshed, it was no longer executing properly and does not show all of the data. Sometimes all data is returned, and other times it is not. For example, this is what the chart should look like (it does look like this sometimes): Then if I refresh, I see this: Here is my data expression: var portal = Portal("https://www.arcgis.com");
// Create a FeatureSet for stable and unstable inspections.
// Group the features by the BLA
var BLA = FeatureSetByPortalItem(portal,"###",0,['BLA_Used'],false);
var groupBLA = GroupBy(BLA,
["BLA_Used"],
[
{ name: "BoatLaunchArea", expression: "BLA_Used", statistic: "COUNT" },
]
);
var combinedDict = {
fields: [
{ name: "BLA", type: "esriFieldTypeString" },
{ name: "cntSurveyScans", type: "esriFieldTypeInteger" },
],
geometryType: "",
features: [],
};
var i = 0;
for (var m in groupBLA) {
combinedDict.features[i] = {
attributes: {
BLA: m["BLA_Used"],
cntSurveyScans: (m["BoatLaunchArea"] / 2),
},
};
i++;
}
return FeatureSet(Text(combinedDict)); This feature layer is updated frequently by Survey123. Could the frequent updates to the layer be causing these issues? This layer also has 8,000 records and counting. Any advice would be appreciated! Erica
... View more
05-21-2021
06:48 AM
|
0
|
1
|
1274
|
|
POST
|
Hi @Anonymous User , Thank you for that tip. Once I started the service and submitted some test data, it created the definition for me. I appreciate your help!
... View more
05-19-2021
12:21 PM
|
0
|
0
|
1784
|
|
POST
|
Hi, I am attempting to use the Event Joiner processor for the first time. I have specified my two input GeoEvent Definitions and the two fields to perform the join on. I have added a name for the new GeoEvent Definition that is created to reflect the joined data. When I go to add the Field Mapper processor after my Event Joiner processor, I can not find the new GeoEvent definition in my list of options. Is there a really obvious step I am missing here? Thank you,
... View more
05-12-2021
08:51 AM
|
0
|
2
|
1810
|
|
POST
|
This also works, and provides a nicely formatted time. Thank you for that. I was just digging into this blog to figure out how to format that.
... View more
05-07-2021
11:10 AM
|
1
|
0
|
4227
|
|
POST
|
@XanderBakker That worked! I changed the esriFieldTypeDate to esriFieldTypeString, and it worked perfectly. Thank you!
... View more
05-07-2021
11:02 AM
|
0
|
1
|
4229
|
|
POST
|
So with this example, I see (what looks like) the same result in the console, minus spatial reference info: Use Console Function to output messages.
{"fields":[{"name":"EQNum","type":"esriFieldTypeString"},{"name":"InspecDate","type":"esriFieldTypeDate"},{"name":"PtStatus","type":"esriFieldTypeString"}],"geometryType":"esriGeometryPoint","features":[{"geometry":{"x":-7997522.018099999,"y":5207172.07},"attributes":{"EQNum":"EQ2013-026","InspecDate":"2020-07-29T16:00:00.000Z","PtStatus":"Unstable"}},{"geometry":{"x":-7997970.5297,"y":5214400.591300003},"attributes":{"EQNum":"EQ1989-015","InspecDate":"2020-09-30T16:00:00.000Z","PtStatus":"Unstable"}},{"geometry":{"x":-7993994.632999999,"y":5212258.8379999995},"attributes":{"EQNum":"EQ2020-052","InspecDate":"2020-10-19T16:00:00.000Z","PtStatus":"Unstable"}},{"geometry":{"x":-8002495.5656,"y":5219019.943500005},"attributes":{"EQNum":"EQ2017-040","InspecDate":"2020-11-23T17:00:00.000Z","PtStatus":"Unstable"}},{"geometry":{"x":-7998590.2183,"y":5226627.4831000045},"attributes":{"EQNum":"EQ2021-020","InspecDate":"2021-04-21T16:00:00.000Z","PtStatus":"Unstable"}}]}
... View more
05-07-2021
09:51 AM
|
0
|
0
|
4193
|
|
POST
|
@XanderBakker I have tried figuring this out by browsing through GeoNet but can't find anything relating to this issue...I added the console function right before the return statement at the end, because this is still returning an empty dictionary. When I hit "Test" and view the output from the console, I see this: ["features returned",{"fields":[{"name":"EQNum","type":"esriFieldTypeString"},{"name":"InspecDate","type":"esriFieldTypeDate"},{"name":"PtStatus","type":"esriFieldTypeString"}],"geometryType":"esriGeometryPoint","features":[{"geometry":{"x":-7997522.018099999,"y":5207172.07,"spatialReference":{"latestWkid":3857,"wkid":102100}},"attributes":{"EQNum":"EQ2013-026","InspecDate":"2020-07-29T16:00:00.000Z","PtStatus":"Unstable"}},{"geometry":{"x":-7997970.5297,"y":5214400.591300003,"spatialReference":{"latestWkid":3857,"wkid":102100}},"attributes":{"EQNum":"EQ1989-015","InspecDate":"2020-09-30T16:00:00.000Z","PtStatus":"Unstable"}},{"geometry":{"x":-7993994.632999999,"y":5212258.8379999995,"spatialReference":{"latestWkid":3857,"wkid":102100}},"attributes":{"EQNum":"EQ2020-052","InspecDate":"2020-10-19T16:00:00.000Z","PtStatus":"Unstable"}},{"geometry":{"x":-8002495.5656,"y":5219019.943500005,"spatialReference":{"latestWkid":3857,"wkid":102100}},"attributes":{"EQNum":"EQ2017-040","InspecDate":"2020-11-23T17:00:00.000Z","PtStatus":"Unstable"}},{"geometry":{"x":-7998590.2183,"y":5226627.4831000045,"spatialReference":{"latestWkid":3857,"wkid":102100}},"attributes":{"EQNum":"EQ2021-020","InspecDate":"2021-04-21T16:00:00.000Z","PtStatus":"Unstable"}}]}] The console returns the 5 results I am looking for/know should be returned. I was unsure if this was happening because of the included geometry, so I removed that and tested again with the same result (console showing 5 features, but empty dictionary.
... View more
05-07-2021
09:05 AM
|
0
|
2
|
4400
|
|
POST
|
@XanderBakker Apologies for another question. I am trying to create a new data expression to populate a list with some basic information on these features that have no related records. I also want to pass through the geometry so I can then use the list to zoom to features in the map; this time I am maintaining the unique ID field "EQ File Number" which I hope will allow me to accommodate this. The code below is kind of a Frankenstein from the code you helped me with the other day and some other code I used in a different data expression. It creates the dictionary, but when I "Test" it just shows an empty table. I had figured I wanted to do all of this within the first for loop, but I am not really sure. If you had a suggestion, it would be appreciated. var p = 'https://www.arcgis.com';
var itemID_CMpts = 'xxx';
var layerID_CMpts = 0;
var relationshipName = "";
var fs1 = Filter(FeatureSetByPortalItem(Portal(p), itemID_CMpts, layerID_CMpts, ['Point_Status', 'EQ_File_Number', 'Inspection_Date'], true), "Point_Status ='Unstable' AND EQ_File_Number In ('EQ2015-078', 'Eq2013-026', 'EQ2018-082', 'EQ2018-052', 'EQ2001-080X', 'EQ2003-021', 'EQ1989-015', 'EQ2002-023', 'EQ2002-045X', 'EQ2019-110', 'EQ2020-017', 'EQ2019-091', 'EQ2018-029', 'EQ2020-033', 'EQ2019-036', 'EQ2020-052', 'EQ2019-064', 'EQ2017-040', 'EQ2020-031', 'EQ2021-003', 'EQ2011-016', 'EQ2017-026', 'EQ2021-020')");
var i = 0;
for (var f in fs1) {
var fs2 = FeatureSetByRelationshipName(f, relationshipName, ['Point_Status_revisit'], false);
var cnt = Count(fs2);
if (cnt == 0) {
i +=1;
// create data schema
var Dict = {
'fields': [
{'name': 'EQNum', 'type': 'esriFieldTypeString'},
{'name': 'InspecDate', 'type': 'esriFieldTypeDate'},
{'name': 'PtStatus', 'type': 'esriFieldTypeString'},
],
'geometryType': '',
'features':[]};
for (var f in fs1) {
attributes: {
EQNum: f["EQ_File_Number"],
InspecDate: f["Inspection_Date"],
PtStatus: f["Point_Status"],
},
};
i++
}
}
return FeatureSet(Text(Dict))
... View more
05-07-2021
06:59 AM
|
0
|
0
|
4405
|
|
POST
|
Thank you for this information - that all makes sense and is what I suspected. I will play around with this and see if I can figure it out. I really appreciate all of your help and your learning suggestions.
... View more
05-05-2021
08:32 AM
|
0
|
0
|
4411
|
|
POST
|
@XanderBakker One additional question has come up. In my Dashboard, I have a map. I would like to set a Map Action so that all of my indicators are updated based on map extent. When I set this, my indicator changes to display "no data". Are map actions not compatible with elements configured via Data Expression?
... View more
05-05-2021
07:53 AM
|
0
|
3
|
4417
|
|
POST
|
That worked perfectly! Thank you. One question I do have...what are your recommended methods for someone to learn more about Arcade? I have taken the courses available through the Esri training catalog, but felt they left a lot to be desired. I do look at the Developer Reference for Arcade, but I find this less helpful in some instances.
... View more
05-05-2021
07:37 AM
|
0
|
1
|
4417
|
|
POST
|
@XanderBakker Ah I see. I am perplexed by my data. This was created via Pro with a named relationship class based on GlobalID/GUID, however this is what I see via the REST endpoint. I would have expected to see the relationship class name that I defined in Pro before I published these data to ArcGIS Online. Out of curiosity, I added this layer to a new map and went into the pop-up to add a new expression. I clicked through $feature like you mentioned, found related records at the bottom and then clicked FeatureSetByRelationshipName to add it into the builder window. This is what I see. FeatureSetByRelationshipName($feature,"") Here is the Arcade I attempted...I am now getting the "Unable to execute Arcade script" message again, even though it returns the correct number of records when I click "Test": var p = 'https://www.arcgis.com';
var itemID_CMpts = 'xxx';
var layerID_CMpts = 0;
var relationshipName = "";
var fs1 = Filter(FeatureSetByPortalItem(Portal(p), itemID_CMpts, layerID_CMpts, ['Point_Status', 'EQ_File_Number'], false), "Point_Status ='Unstable' AND EQ_File_Number In ('EQ2015-078', 'Eq2013-026', 'EQ2018-082', 'EQ2018-052', 'EQ2001-080X', 'EQ2003-021', 'EQ1989-015', 'EQ2002-023', 'EQ2002-045X', 'EQ2019-110', 'EQ2020-017', 'EQ2019-091', 'EQ2018-029', 'EQ2020-033', 'EQ2019-036', 'EQ2020-052', 'EQ2019-064', 'EQ2017-040', 'EQ2020-031', 'EQ2021-003', 'EQ2011-016', 'EQ2017-026', 'EQ2021-020')");
var tot = 0;
for (var f in fs1) {
var fs2 = FeatureSetByRelationshipName(f, relationshipName, ['Point_Status_revisit'], false);
var cnt = Count(fs2);
if (cnt == 0) {
tot += 1;
}
}
return tot;
... View more
05-05-2021
05:59 AM
|
0
|
7
|
12474
|
|
POST
|
I will give this a try tomorrow morning. One question...the relationship name that I put in there, is it the name of the relationship class in the fGDB from pre-publishing to AGOL?
... View more
05-04-2021
11:44 AM
|
0
|
9
|
12480
|
|
POST
|
Hi Xander, Thank you for the example. I was able to get this to work using something I came up with that basically does what you showed in the example. Unfortunately, this is not quite what I need after reflecting on the results. What I really want to be able to do is get the count of records in my point layer that do not have any related records associated with them. Is that possible using the FeatureSetByRelationshipName parameter? I've seen some other posts you have responded to around FeatureSetByRelationshipName, but none of the examples talk about doing something like what I am trying to accomplish. Thank you,
... View more
05-04-2021
09:00 AM
|
0
|
11
|
12488
|
|
POST
|
Hi, I am very new to Arcade (which you probably be able to tell by my filter expressions below). I am attempting to create a Data Expression that can be used to power an Indicator widget in a Dashboard. I have built and tested this in the Data Expression builder within my Dashboard and when I click "test" it returns the proper result. I click done, but then see a little triangle with an ! telling me "Unable to execute Arcade script". Why would I see this message? My Arcade script is below. Any help would be appreciated. var p = 'https://www.arcgis.com';
var itemID_CMpts = 'xxx';
var layerID_CMpts = 0;
var fs1 = FeatureSetByPortalItem(Portal(p), itemID_CMpts, layerID_CMpts, ['Point_Status', 'EQ_File_Number'], false);
var filterCMpts = Filter(fs1, "Point_Status ='Unstable' AND EQ_File_Number ='EQ2015-078' OR Point_Status ='Unstable' AND EQ_File_Number = 'Eq2013-026' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2018-082' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2018-052' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2001-080X' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2003-021' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ1989-015' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2002-023' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2002-045X' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2019-110' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2020-017' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2019-091' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2018-029' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2020-033' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2019-036' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2020-052' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2019-064' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2017-040' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2020-031' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2021-003' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2011-016' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2017-026' OR Point_Status ='Unstable' AND EQ_File_Number = 'EQ2021-020'");
var itemID_join = 'xxx';
var layerID_join = 0;
var fs2 = FeatureSetByPortalItem(Portal(p), itemID_join, layerID_join, ['Point_Status_revisit', 'EQ_File_Number'], false);
var filterJoin = Filter(fs2, "Point_Status_revisit ='Stable' AND EQ_File_Number ='EQ2015-078' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'Eq2013-026' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2018-082' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2018-052' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2001-080X' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2003-021' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ1989-015' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2002-023' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2002-045X' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2019-110' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2020-017' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2019-091' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2018-029' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2020-033' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2019-036' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2020-052' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2019-064' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2017-040' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2020-031' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2021-003' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2011-016' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2017-026' OR Point_Status_revisit ='Stable' AND EQ_File_Number = 'EQ2021-020'");
var CntCMpts = Count(filterCMpts)
var CntJoin = Count(filterJoin)
return CntCMpts - CntJoin Thank you!
... View more
04-28-2021
09:14 AM
|
1
|
27
|
21224
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 2 weeks ago | |
| 1 | 2 weeks ago | |
| 1 | 09-06-2022 09:14 AM | |
| 6 | 10-24-2024 12:04 PM | |
| 1 | 04-28-2021 09:14 AM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|