|
POST
|
No, this will be the data source of the indicator. In the Settings window, click the Change button for the Layer and create a new data expression.
... View more
05-09-2024
12:46 PM
|
0
|
3
|
2550
|
|
IDEA
|
When I create a new element in my testing dashboard, I can select a Data Expression from a list of existing expressions. However, since I wasn't very creative in naming all of my expressions, I'm presented with a list like this If I open a specific data expression to review its code, I can't exit out of the Arcade editor and select another expression without starting the process of creating a new element again. There should be a separate button that closes the editor and takes me back to the list of data expressions in the Select a layer dialog.
... View more
05-09-2024
12:05 PM
|
2
|
1
|
739
|
|
POST
|
You can specify the field in the URL (this shows the picture in the popup) and the Hyperlink (this opens a new window). Here's an example that uses a thumbnail in the popup for a fast draw, but a full-size image for the new window. Each site has a unique photo.
... View more
05-09-2024
11:22 AM
|
2
|
5
|
5031
|
|
POST
|
If you want to get the average time for all the flights, then you'll want to create a FeatureSet to be used in the indicator var p = Portal("https://arcgis.com");
var fs = FeatureSetByPortalItem(p, 'itemId', 0);
var cumulative_flight_time = 0;
var counter = 0;
for (var f in fs) {
var startDate = Date(f.START_TIME)
var endDate = Date(f.END_TIME)
var flightTime = DateDiff(endDate, startDate, 'minutes')/60
cumulative_flight_time += flightTime;
counter++;
}
var theDict = {
'fields': [{ 'name': 'ave_flight_time', 'type': esriFieldTypeDouble'}],
'geometryType': '',
'features': [
{
'attributes': {
'ave_flight_time': cumulative_flight_time / counter
}
}
]
};
return FeatureSet(theDict);
... View more
05-09-2024
10:55 AM
|
1
|
5
|
2563
|
|
POST
|
Can you post your script? Does it return an empty FeatureSet or the number 0?
... View more
05-08-2024
09:07 AM
|
0
|
1
|
2604
|
|
POST
|
You can use the ArcGIS Assistant to make modifications to the JSON that powers your maps and apps. In the JSON editor, you can search and replace feature service urls or item ids. I would suggest doing this on a copy of your map in case you make an unrecoverable error. Take a look at the instructions to see what you can do with this tool.
... View more
05-08-2024
07:37 AM
|
1
|
1
|
1340
|
|
POST
|
Unfortunately, you can't use label formatting tags in Arcade.
... View more
05-03-2024
09:33 AM
|
0
|
0
|
778
|
|
POST
|
You'll have to use an Arcade element instead of a chart. This uses the "media" popupElement in the return. Here's an example with your code that creates a basic bar chart var state = $feature.AALRegion;
var portal = Portal('https://www.arcgis.com');
var fields = [
'OBJECTID',
'Region',
'gridcode',
'Hectares'
];
var fs = FeatureSetByPortalItem(
portal,
'7369e87b3b104eae8c18507261184083', // FeatureService ID that you want to grab fields from.
0, // Sublayer index, usually 0.
fields, // Array of fields to grab from the FeatureService.
False // Include geometry?
);
var final = GroupBy(Filter(fs,"Region = @state"),'gridcode',
{
name: 'sumhec',
expression: 'Hectares',
statistic: 'SUM'
},
);
var Values = {};
var barNames = [];
for (var i in final) {
Values[Text(i.gridcode)] = i.sumhec; //you have to use a Text string for the Value keys. It doesn't work with numbers
Push(barNames, i.gridcode)
}
return {
type: "media",
attributes:Values,
mediaInfos:[{
type: "barchart",
title: `Sum of ${state}`,
value: {
fields: barNames
}
}]
}
... View more
05-02-2024
06:15 AM
|
1
|
1
|
2081
|
|
POST
|
The dictionary contained the field "ArrivalTime" but you were assigning 0 to "Arrival_Time". for (var t in Length_Canada) {
combinedDict.features[i++] = {
attributes: {
Shape_Length: t["Shape__Length"],
ArrivalTime: 0
},
geometry: Geometry(t)
};
}
... View more
04-30-2024
07:48 AM
|
0
|
0
|
2035
|
|
POST
|
Have you used @JRhodes's suggestion to use console messages to check your variables at various steps?
... View more
04-26-2024
07:43 AM
|
0
|
1
|
1072
|
|
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
04-26-2024
07:13 AM
|
0
|
3
|
1116
|
|
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
04-23-2024
02:15 PM
|
0
|
2
|
2335
|
|
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
04-23-2024
11:23 AM
|
0
|
6
|
2351
|
|
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
04-23-2024
07:27 AM
|
0
|
0
|
1420
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-04-2025 06:39 AM | |
| 1 | 05-01-2026 08:26 AM | |
| 1 | 04-10-2026 12:01 PM | |
| 1 | 04-13-2026 09:11 AM | |
| 1 | 10-11-2023 06:18 AM |
| Online Status |
Online
|
| Date Last Visited |
3 hours ago
|