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
4 hours ago
|
0
|
1
|
24
|
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
7 hours ago
|
0
|
5
|
40
|
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
10 hours ago
|
0
|
0
|
12
|
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
Thursday
|
0
|
2
|
118
|
POST
|
Take a look at the page on template literals. The two examples I provided give the same output.
... View more
Thursday
|
1
|
4
|
128
|
POST
|
If you use regular quotes, then the line would like this var output = 'x: ' + thePoint.x + ', y: ' + thePoint.y
... View more
Thursday
|
0
|
6
|
144
|
POST
|
My code uses template literals , which uses the back tick (`) instead of the regular quote (').
... View more
Thursday
|
0
|
8
|
146
|
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
Thursday
|
1
|
10
|
159
|
POST
|
You can check the status of ArcGIS Hub at the Health Dashboard and report any issues.
... View more
Wednesday
|
0
|
0
|
83
|
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
a week ago
|
0
|
0
|
56
|
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
a week ago
|
0
|
1
|
168
|
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
a week ago
|
0
|
3
|
179
|
POST
|
A Data Expression has to return a FeatureSet //var result = Round(total, 0);
//return result
var Dict = {
'fields': [
{'name': 'Result', 'type': 'esriFieldTypeInteger'}],
'geometryType': '',
'features': []};
// fill the data schema with the data
Dict.features[0] = {
'attributes': {
'Result': Round(total, 0)
}}
// return the featureset
return FeatureSet(Text(Dict));
... View more
2 weeks ago
|
1
|
1
|
192
|
POST
|
Which version of QuickCapture are you using? Arcade wasn't supported in versions before 1.18.
... View more
2 weeks ago
|
0
|
0
|
90
|
Title | Kudos | Posted |
---|---|---|
1 | Thursday | |
1 | Thursday | |
1 | 12-15-2023 08:33 AM | |
1 | 2 weeks ago | |
1 | 2 weeks ago |
Online Status |
Online
|
Date Last Visited |
4 hours ago
|