|
POST
|
You can do this by first creating a new Arcade expression that has the logic to add the title. Then in the Title configuration, click {}, then choose the expression. if (!IsEmpty($feature.Title) return `(${$feature.Title})` The pop's title would look like this: {name} {expression/expr0}. I'm not clear on how the 'Alternative Title' fits into this, though
... View more
03-01-2024
10:20 AM
|
2
|
0
|
5136
|
|
IDEA
|
I agree, why was that functionality changed? It's annoying that you can't directly click on the title to open the item, but have to move the mouse to the View Detail button.
... View more
03-01-2024
09:55 AM
|
0
|
0
|
2221
|
|
POST
|
You can check if those values are empty before doing your calculations var Status = $datapoint.OutageStatus;
var Off = $datapoint.DateOff;
var On = $datapoint.DateRelightComplete;
var HoursOff;
if (IsEmpty(On) || IsEmtpy(Off)) {
HoursOff = 0;
} else {
HoursOff = Round(DateDiff(On, Off, 'hours'), 1);
}
return {
textColor: '',
backgroundColor: '',
separatorColor:'',
selectionColor: '',
selectionTextColor: '',
attributes: {
HoursOff:HoursOff,
}
} or you can use the IsNan function afterward var Status = $datapoint.OutageStatus
var Off = $datapoint.DateOff
var On = $datapoint.DateRelightComplete
var DaysOff = DateDiff (On, Off, 'hours')
var HoursOff = Round(DaysOff,1)
if (IsNan(HoursOff)) HoursOff = 0;
... View more
02-29-2024
10:12 AM
|
1
|
0
|
3349
|
|
POST
|
If you want the hours just rounded to something like 2.5, use Round function (and template literals) return `${Round(TimeDiff - HoursOff, 1)} hours` You can add this to return the hours and minutes var TotalTime = TimeDiff - HoursOff
var Hours = Floor(TotalTime);
var Minutes = Floor((TotalTime - Hours) * 60)
return `${Hours} hours and ${Minutes} minutes`
... View more
02-28-2024
10:52 AM
|
0
|
1
|
1870
|
|
POST
|
There is a for await...of loop that you can use in this case.
... View more
02-28-2024
09:59 AM
|
1
|
1
|
3607
|
|
POST
|
This should work. It calculates the number of days between the start date and end date and subtracts 15 hours for each day. var StartDate = $feature.TimeStart
var EndDate = $feature.TimeEnd
var TimeDiff = DateDiff(EndDate, StartDate, 'hours')
var DayDiff = DateDiff(DateOnly(EndDate), DateOnly((StartDate)), 'days')
var HoursOff = 15 * DayDiff
return TimeDiff - HoursOff
... View more
02-28-2024
09:21 AM
|
0
|
3
|
1881
|
|
POST
|
Your loops (and you only need one instead of two) aren't getting the attribute from the feature correctly. It should be like this var Owners = FEATURESETBYNAME($DATASTORE,"Owners",["TractID","Contacted"])
var ID = $feature.TractID
var OwnerID = Filter(Owners,"TractID=@ID")
var Cont = 0
var NCont =0
for(var f in OwnerID) {
if(f.Contracted == 'Yes') {
Cont +=1
} else if(f.Contracted == 'No') {
NCont +=1
}
}
if (Cont == 0 && NCont == 0) return null
return Cont/(Cont+NCont) I also added a check to make sure you're not dividing by zero.
... View more
02-28-2024
07:56 AM
|
0
|
1
|
1119
|
|
POST
|
You're missing the URL for that sample: https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Map-Exploration/WorkingWithQueryDefinitionFilters
... View more
02-28-2024
06:56 AM
|
1
|
0
|
2859
|
|
POST
|
There is a GitHub repository of many Arcade expressions. This one shows how to combine multiple layers for use in a Dashboard
... View more
02-27-2024
07:17 AM
|
0
|
0
|
1352
|
|
POST
|
You can use the Schema function to get the domain information for all the fields. This code gives you an array of an array of the fields and their codedValue domain names. var dict = Schema($feature);
var fieldsArray = dict.fields;
var domainsArray = [];
for (var i in fieldsArray) {
if (HasValue(fieldsArray[i], 'domain')) {
if (HasValue(fieldsArray[i].domain, 'codedValues')) {
var domainArray = [fieldsArray[i].name]
for (var d in fieldsArray[i].domain['codedValues']) {
Push(domainArray, fieldsArray[i].domain['codedValues'][d].name)
}
Push(domainsArray,domainArray)
}
}
}
return domainsArray
... View more
02-27-2024
07:12 AM
|
1
|
1
|
2172
|
|
POST
|
The code does work substituting my own portal item. Where is it breaking for you? Are you checking the output at various places in the code with Console to see if it's returning what you're expecting? var p = Portal("https://noaa.maps.arcgis.com/");
var fs = FeatureSetByPortalItem(
p,
'1624f1a86dca4af086cc13141a1b0e2b',
1,
['Authors'],
false
);
// Create empty array for features and feat object
var features = [];
var feat;
// Split comma separated hazard types and store in dictionary.
for (var feature in fs) {
var split_array = Split(feature["Authors"], ',')
var count_arr = Count(split_array)
console(count_arr)
for(var i = 0; i < count_arr; i++ ){
feat = {
'attributes': {
'split_choices': Trim(split_array[i])
}
}
Push(features, feat);
}}
// Empty dictionary to capture each hazard reported as separate rows.
var choicesDict = {
'fields': [
{ 'name': 'split_choices', 'type': 'esriFieldTypeString'}],
'geometryType': '',
'features': features
};
// Convert dictionary to featureSet.
var fs_dict = FeatureSet(choicesDict);
//return fs_dict
// Return featureset after grouping by hazard types.
return GroupBy(fs_dict, ['split_choices'],
[{ name: 'split_count', expression: 'split_choices', statistic: 'COUNT' }]);
... View more
02-27-2024
06:22 AM
|
0
|
0
|
2118
|
|
POST
|
You can't directly compare the epoch number to a Date like that. You'll have to convert it to a Date. Arcade can create a Date from an epoch number, it must be in milliseconds (adding "000" to your attributes). For example: Date(1709269260) = Jan 20, 1970, 1:47:49 PM Eastern Standard Time Date(1709269260000) = Mar 1, 2024, 12:01:00 AM Eastern Standard Time If you want to use that field, then your expression should look like this var started = Date($feature.closureStartEpoch + '000');
var closed = Date($feature.closureEndEpoch + '000');
var present = Date()
If (present >= started && present <= closed) return "Open"
return "Closed"
... View more
02-26-2024
12:45 PM
|
0
|
1
|
1266
|
|
POST
|
You can use the Left function if (Left($feature.ConduitSize, 6) == '1x1.25') return $feature.ClengthFt
... View more
02-26-2024
11:29 AM
|
1
|
0
|
1358
|
|
POST
|
That's not an error, but a warning. You shouldn't use reserved words as variable names. It will still work, but it might cause problems.
... View more
02-26-2024
06:44 AM
|
0
|
2
|
2132
|
| 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 |
Offline
|
| Date Last Visited |
Saturday
|