POST
|
Have you used @JosephRhodes2's suggestion to use console messages to check your variables at various steps?
... View more
yesterday
|
0
|
1
|
51
|
POST
|
In Line 10 of your first post and line 20 in your second post, you're using Top to get the first record, but Top returns a FeatureSet, not a Feature. You have to use First instead to use that feature in the next line. Try this (with a couple of other minor modifications) // Define a Featureset (status) from the layer "Cyanobacteria_Public View" in the $map
// that contains the attribute ['cyano_risk_tier']
var status = FeatureSetByName($map, "Cyanobacteria_Public View");
// Define a variable (risk) to store the value we want
// Get the value by Intersecting the pond polygon location
// with the FeatureSet "Cyano Ponds Public View", or status
// var risk = Top(OrderBy(Intersects(status, Buffer($feature, 30, "meters")), 'fluorometry_date DESC'), 1);
// Not sure if this works
// Instead, try to match by CCC GIS ID
var CCC_GIS_ID = $feature.CCC_GIS_ID;
//var IDS = "CCC_GIS_ID = '" + CCC_GIS_ID + "'";
var RelatedReads = Filter(status, "CCC_GIS_ID = @ccc_GIS_ID");
//var numrelreads = count(RelatedReads);
if (Count(RelatedReads) == 0) return "No updated Information";
var LastSampleDate = First(OrderBy(RelatedReads, "fluorometry_date DESC"));
var edit_datetime = Date(LastSampleDate);
var now_datetime = Now();
var days_dif = DateDiff(now_datetime, edit_datetime, "days");
if (days_dif <= 30) return status['cyano_risk_tier'];
return "No updated Information";
... View more
yesterday
|
0
|
3
|
95
|
POST
|
You had a couple of mistakes (missing commas and an errant return) var contest = Decode(f["Contest_title"],"President of the United States (REP)","A",
"United States Senator (REP)", "C",
"Attorney General (REP)", "E",
"Auditor General (REP)", "G",
"State Treasurer (REP)", "I",
"Representative in Congress -13th District (REP)", "K",
"Representative in the General Assembly -78th District (REP)", "O",
"Delegate to the Republican National Convention (REP)" , "M",
"Alternate Delegate to the Republican National Convention (REP)", "P",
"Republican Committee Person - Bedford Borough West (REP)", "Q",
"Republican Committee Person - Bedford Township 1 (REP)", "R",
"Republican Committee Person - Bedford Township 2 (REP)", "S",
"Republican Committee Person - Everett Borough (REP)", "T",
"Republican Committee Person - Hopewell Township (REP)", "U",
"Republican Committee Person - King Township (REP)", "V",
"Republican Committee Person - West Providence Township (REP)", "W",
"Republican Committee Person - West St. Clair Township (REP)", "X",
"Republican Committee Person - Woodbury Township (REP)", "Y",
"President of the United States (DEM)", "B",
"United States Senator (DEM)", "D",
"Attorney General (DEM)", "F",
"Auditor General (DEM)", "H",
"State Treasurer (DEM)", "J",
"Representative in Congress -13th District (DEM)", "L",
"Delegate to the Democratic National Convention (DEM)", "N",
"Unsatisfactory");
... View more
Tuesday
|
0
|
2
|
93
|
POST
|
With a "return" in each of the if statements, the code will short-circuit and return a single letter (or "Unsatisfactory") for the first feature. You'll want to use the Decode function to return a variable for that logic to be used later. Here, I'm just making a guess in this code without seeing your data and what you're trying to accomplish. It's also untested, so it might need modification. var portal = Portal('https://.maps.arcgis.com')
var fs = FeatureSetByPortalItem(
portal,
'155af3e091404240acd2904e34a07bf6',
0,
['Contest_title'],
false
);
// Create empty array for features and feat object
var features = [];
var feat;
for (var f in fs) {
var contest = Decode(f["Contest_title"],"President of the United States (REP)","A",
"United States Senator (REP)", "C",
"Attorney General (REP)", "E",
//the rest of the options
"Delegate to the Democratic National Convention (DEM)", "N",
"Unsatisfactory");
feat = {
attributes: {
Contest_ID: contest,
},
};
Push(features, feat);
}
var choicesDict = {
'fields': [
{ 'name': 'Contest_ID', 'type': 'esriFieldTypeString'}],
'geometryType': '',
'features': features
};
// Convert dictionary to featureSet.
var fs_dict = FeatureSet(Text(choicesDict));
// Return featureset after grouping by hazard types.
return GroupBy(fs_dict, ['Contest_ID'],
[{ name: 'Contest_ID', expression: 'Contest_ID', statistic: 'MAX' }]); .
... View more
Tuesday
|
0
|
6
|
109
|
POST
|
Querying dates in SQL can be picky, especially if there is time involved. In some testing I was doing on my data, if I queried it using "Date = '07/10/2016'", it would return 0 features. If I queried using "Date > '07/10/2016' AND DATE1 <= '07/11/2016'", it would return 29 records. The query "cast(Date1 as date) = cast('7/10/2016' as date)" also returned 29 records. However, there are 36 records on that date, since I have several records after 8 pm ET (which is after midnight on the next day in UTC). This query finally returned all 36 records var offset = -TimeZoneOffset(Now()); //returns time zone offset in milliseconds. Use - for Western Hemisphere
var startDate = DateAdd(Date(2016,06,10), offset, 'milliseconds');
var endDate = DateAdd(startDate, 1, 'day');
var filtered = Filter(fs, "Date1 > @startDate AND DATE1 <= @endDate");
return (Orderby(filtered, 'Date1 ASC'));
... View more
Tuesday
|
0
|
0
|
36
|
POST
|
I had overlooked that the Geometry bundle is not available in the Dashboard list formatting profile, most likely for performance gains. I'm looking into a way to add that to your data as you load it into Dashboard
... View more
a week ago
|
0
|
2
|
145
|
POST
|
Take a look at the page on template literals. The two examples I provided give the same output.
... View more
a week ago
|
1
|
4
|
155
|
POST
|
If you use regular quotes, then the line would like this var output = 'x: ' + thePoint.x + ', y: ' + thePoint.y
... View more
a week ago
|
0
|
6
|
171
|
POST
|
My code uses template literals , which uses the back tick (`) instead of the regular quote (').
... View more
a week ago
|
0
|
8
|
173
|
POST
|
You can use the Centroid function to get the center point for a polygon. var thePoint = Centroid(Geometry($feature));
var output = `x: ${thePoint.x}, y: ${thePoint.y}`
... View more
a week ago
|
1
|
10
|
186
|
POST
|
You can check the status of ArcGIS Hub at the Health Dashboard and report any issues.
... View more
a week ago
|
0
|
0
|
155
|
POST
|
That should be set by the layer's name, either from the web map or the feature service. If you look at this popup sample, that heading is "US Counties". If you look at the web map used in the sample, you'll see that the layer has the title of "US Counties". For a sample using a service, the heading has "ACS Marital Status Boundaries - Tract", the service name and layer name. The empty space next to your symbol for that Untitled layer can have text that is set by the PopupTemplate's title property.
... View more
2 weeks ago
|
0
|
0
|
59
|
POST
|
Ooops, I tested it on a popup, not the field calculator. You have to get the layer from the $datastore variable, not the $layer variable. var fs = FeatureSetByName($datastore,'your layer name')
return $feature.disability_ACSHHDIS/Sum(fs, 'disability_ACSHHDIS') * 100
... View more
2 weeks ago
|
0
|
1
|
190
|
POST
|
You're just getting the sum of that single feature in line 1, so its percentage would always be 100%. You have to get the sum of all the features in the dataset to calculate the percentage return $feature.data/Sum($layer, 'data') * 100)
... View more
2 weeks ago
|
0
|
3
|
201
|
Title | Kudos | Posted |
---|---|---|
1 | 07-22-2021 02:14 PM | |
1 | a week ago | |
1 | a week ago | |
1 | 12-15-2023 08:33 AM | |
1 | 2 weeks ago |
Online Status |
Offline
|
Date Last Visited |
yesterday
|