|
POST
|
Unfortunately, you can't set the symbology directly through Arcade. You have to go into the Styles editor and change the colors for each of the returned values. You can simplify the code this way. var values = [10, 20, 30, 40, 50, 60, 90, 130, 150, 170, 210]
IIf(IndexOf(values, $feature.Color) > -1, $feature.Layer, 'Error')
... View more
02-23-2024
12:04 PM
|
1
|
0
|
1165
|
|
POST
|
Unfortunately, the Map Viewer doesn't support label formatting tags in Arcade
... View more
02-23-2024
11:15 AM
|
0
|
1
|
2164
|
|
POST
|
You can create a url using the attributes from the feature. In this example, I'm creating a link using the feature's Site_ID field for an Arcade element. Since some of the features don't have an associated video, I have to check another field (VideoExists). var output
var url = 'https://www.sample.com/'
if ($feature.VideoExists == "Yes") {
output = `<a href="${url}${$feature.Site_ID}.mp4">Site ${$feature.Site_ID}</a> video`
}
return {
type : 'text',
text : output
} Note that the code is building the url link with template literals, enclosed in backticks instead of the regular quotes
... View more
02-23-2024
10:52 AM
|
0
|
0
|
949
|
|
POST
|
You're supplying the FeatureSetById function incorrect parameters, which would look like this: var features = FeatureSetById($map,'DemoLayerWM_1117', ['*'], true); It looks likes you should be using the FeatureSetByPortalItem, which looks like this: var features = FeatureSetByPortalItem(
Portal('https://www.arcgis.com'),
'7b1fb95ab77f40bf8aa09c8b59045449',
0,
['Name', 'Count'],
false
); If you have set up a relationship between the feature layer and the tables you can use the FeatureSetByRelationshipName function. This allows you to get there related records without having to loop through all the features. Here's an example of retrieving the related records for a popup. var rec = First(FeatureSetByRelationshipName($feature, "DCGIS.ITSPE", ['BIDNAME', 'BIDTOTALDUE', 'BIDCOLLECTED', 'BIDBALANCE']));
if (IsEmpty(rec.BIDNAME)) return 'Not a BID';
return `${rec.BIDNAME}
• Total Due: ${Text(rec.BIDTOTALDUE, '$#,###.00')}
• Collected: ${Text(rec.BIDCOLLECTED, '$#,###.00')}
• Balance: ${Text(rec.BIDBALANCE, '$#,###.00')}` This example is uses a public service, so you can examine how it uses the relationships.
... View more
02-23-2024
10:40 AM
|
1
|
0
|
1407
|
|
POST
|
IsEmpty returns true if a field either has a null value or an empty string (''). You'll have to check separately for the 0 value, since that is not null. var gap = IIf(IsEmpty($datapoint.gap_percent) || $datapoint.gap_percent == 0, "0", $datapoint.gap_percent)
... View more
02-23-2024
09:57 AM
|
1
|
1
|
1543
|
|
POST
|
Arcade cannot return symbols like that. What you'll have to do is symbolize the returned values in the legend editor. var output;
If ($feature["Win/Loss"] == 'Retained' || $feature["Win/Loss"] == 'Win') {
output = 'blue';
} Else If ($feature["Win/Loss"] == 'Bid / Not Win' || $feature["Win/Loss"] == 'No Bid' || $feature["Win/Loss"] == 'Loss') {
output = 'red';
} Else {
output = 'yellow ';
}
If ($feature["MARTIN_OR_BLUE_WATER"] == 'BLUE WATER') output += ' outlined';
return output;
... View more
02-15-2024
01:56 PM
|
0
|
0
|
2670
|
|
POST
|
Here's an example of how to filter your data by time. This filters recent earthquakes, returning quakes between one and two months ago. var p = Portal("https://www.arcgis.com");
var fs = FeatureSetByPortalItem(p, '9e2f2b544c954fda9cd13b7f3e6eebce', 0, ['eventTime'])
var time1 = Dateadd(Today(), -1, 'month')
var time2 = Dateadd(Today(), -2, 'month')
var sql = `eventTime < '${time1}' and eventTime > '${time2}'`
return Filter(fs, sql)
... View more
02-15-2024
01:14 PM
|
0
|
0
|
1135
|
|
POST
|
Instead of using the Image content, use Arcade element. This would be your expression var output;
if (Lower($feature.CVA_Partner_) == "yes" || Lower($feature.CVA_Partner_) == "y") output = '<img src=".../sharing/rest/content/items/78df60bf1f274f26b96176d9975cdbf7/data" alt="Image">'
return {
type : 'text',
text : output //this property supports html tags
}
... View more
02-15-2024
11:05 AM
|
0
|
0
|
3071
|
|
POST
|
Due to security concerns, custom widgets cannot be deployed in AGOL. You options are to use ArcGIS Enterprise or to host the experience on your own site.
... View more
02-15-2024
10:17 AM
|
1
|
0
|
1281
|
|
POST
|
You have to return the value in a FeatureSet like this return FeatureSet(Text({
fields: [{name: 'the_percentage', type: 'esriFieldTypeSingle'}],
geometryType: '',
features: [{attributes:{the_percentage:percentMatched}}]
}))
... View more
02-14-2024
11:51 AM
|
1
|
1
|
3764
|
|
POST
|
Does this null check work instead? if (IsEmpty(GetUser($layer))) return "Empty";
return GetUser($layer).fullName;
... View more
02-13-2024
06:02 PM
|
0
|
1
|
2009
|
|
POST
|
Yes, this is using a Data Expression. It would look something like this var p = Portal("https://arcgis.com");
var poles = FeatureSetByPortalItem(p, yourItemID, 0);
//your code to set variables thisYearValue, thisMonthValue, and lastMonthValue
var jsonDictionarySTART = {
fields: [{
alias: "This Year",
name: "THISYEAR",
type: "esriFieldTypeInteger",
},
{
alias: "This Month",
name: "THISMONTH",
type: "esriFieldTypeInteger",
},
{
alias: "Last Month",
name: "LASTMONTH",
type: "esriFieldTypeInteger",
},
],
spatialReference: { wkid: 4326 },
geometryType: "esriGeometryPoint",
features: [{
attributes: {
THISYEAR: thisYearValue,
THISMONTH: thisMonthValue,
LASTMONTH: lastMonthValue
},
}]
};
return FeatureSet(Text(jsonDictionarySTART));
... View more
02-12-2024
08:44 AM
|
1
|
1
|
2507
|
|
POST
|
You can't put line breaks into an indicator, so you could do something like this: But honestly, that isn't the most intuitive presentation of data. A better one might be a Details element, which you could configure like this
... View more
02-09-2024
04:15 PM
|
0
|
3
|
2557
|
|
POST
|
Can you provide some more details on how you're adding this? I've put that phrase into a field in a feature layer and used that in a text element. I also put that phrase directly into a text element. Neither of them is showing that issue
... View more
02-09-2024
08:37 AM
|
1
|
1
|
1211
|
| Title | Kudos | Posted |
|---|---|---|
| 3 | Monday | |
| 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 |
| Online Status |
Offline
|
| Date Last Visited |
Thursday
|