|
POST
|
The feature name contains special characters (& or <), which causes the formatting to fail. You have to replace those characters with their equivalent character codes (& and <) replace($feature.Name, "&", "&") + TextFormatting.NewLine + "<CLR red = '255'>"+ $feature.Address +"</CLR>"
... View more
02-20-2025
12:36 PM
|
0
|
1
|
1336
|
|
POST
|
Did you set autoLoad to true in the module? ...
<modules>
<insertModule id="ConditionsAndStates_Module" className="Module1"
autoLoad="true" caption="Module1">
...
... View more
02-20-2025
11:47 AM
|
0
|
1
|
3052
|
|
POST
|
Another way you can do is to change all the values for the records you want suppressed to -1 (or another value) . You'd have to put a note in the chart saying what that value means. Here's an example, using a sample Esri dataset. This show the value that's being checked, but not the other values for each record. If you don't want to show that, remove lines 19-23 and uncomment line 24. var fields = ["AVGHHSZ_CY", "EDUC01_CY", "EDUC02_CY"];
// Returns the first feature in the layer
var fs = Top(
FeatureSetByPortalItem(
Portal("https://www.arcgis.com"),
"7b1fb95ab77f40bf8aa09c8b59045449",
0,
fields,
false
),
99
);
var features = [];
//return theDict
for (var f in fs) {
var attDict = {};
for (var a in fields) {
if (fields[a] == "AVGHHSZ_CY") {
attDict[fields[a]] = f[fields[a]];
} else {
attDict[fields[a]] = IIf(f["AVGHHSZ_CY"] > 3, f[fields[a]], -1);
}
//attDict[fields[a]] = IIf(f["AVGHHSZ_CY"] > 3, f[fields[a]], -1);
}
Push(features, { attributes: attDict });
}
return FeatureSet(
{ fields: Schema(fs).fields, geometryType: "", features: features }
);
... View more
02-19-2025
12:51 PM
|
1
|
0
|
1736
|
|
POST
|
You have to look at the Arcade profiles to see what variables are available in different circumstances. For the Field calculation profile, only $feature and $datastore are available. $map is available in other profiles, like popup or popup element.
... View more
02-19-2025
11:41 AM
|
3
|
1
|
4121
|
|
POST
|
I can't think of a way to include text with a numeric field to be used in a serial chart. Could you use a Value Guide to hide those?
... View more
02-19-2025
09:15 AM
|
1
|
1
|
1752
|
|
POST
|
When posting a question with code, please use the "Insert/Edit code sample" button You can hide the records that don't have enough daily cases simply by using the Filter function. var fsportal = Portal("https://www.arcgis.com/");
var fs = FeatureSetByPortalItem(
fsportal,
"dfc071575e924d5d88cb851eab914222",
0,
[
"Total_Daily_Cases",
"Hispanic_or_Latino",
"Not_Hispanic_or_Latino",
"Unknown_Ethnicity",
"Ethnicity_Not_Reported",
"Black_or_African_American",
"White_Race",
"Other_Race",
"Native_Hawaiian_or_Other_Pacific_Islander_Race",
"Asian_Race",
"American_Indian_or_Alaskan_Native_Race",
"Unknown_Race",
"Race_Not_Reported",
"Unknown_Age_Group",
"00_17_Age_Group",
"18_29_Age_Group",
"30_39_Age_Group",
"40_49_Age_Group",
"50_64_Age_Group",
"65_74_Age_Group",
"75__Age_Group",
"Year"
],
false
);
Filter(fs, "Total_Daily_Cases <= 5")
... View more
02-19-2025
08:21 AM
|
1
|
3
|
1762
|
|
POST
|
What I mean is that the attribute keys have to be the same as the Dictionary field names to be mapped properly attributes: {
WorkOrderID: Text(wo["WorkOrderID"]), // Ensure it's string
InitiateDate: Date(startDate),
ActualFinishDate: Date(endDate),
DaysToComplete: Floor(daysToComplete),
OBJECTID: (wo["OBJECTID"]),
Description: (wo["DESCRIPTION"])
}
--------------------
fields: [
{ name: "WorkOrderID", alias: "Work Order ID", type: "esriFieldTypeString" },
{ name: "InitiateDate", alias: "Initiate Date", type: "esriFieldTypeDate" },
{ name: "ActualFinishDate", alias: "Actual Finish Date", type: "esriFieldTypeDate" },
{ name: "daysToComplete", alias: "Days To Complete", type: "esriFieldTypeInteger" },
{ name: "Description", alias: "Description", type: "esriFieldTypeString" },
{ name: "OBJECTID", alias: "OBJECTID", type: "esriFieldTypeOID" },
],
... View more
02-19-2025
07:26 AM
|
0
|
0
|
2572
|
|
POST
|
The field names in the dictionary ("startDate" and "endDate") are different than the attributes in the array ("InitiateDate" and "ActualFinishDate")
... View more
02-19-2025
06:04 AM
|
0
|
2
|
2579
|
|
POST
|
I ran your code using my own data and discovered that you have to convert daysToComplete to an integer (line 34). Otherwise, it ran correctly (with some field name changes and a different minimum days) var workorders = Top(
FeatureSetByPortalItem(
Portal("https://noaa.maps.arcgis.com/"),
"b6b9dd55450a4f64bcafb3cd6e005a5c",
0,
["stormdate", "surveydate", "efscale", "OBJECTID"],
true
),
10
);
var filteredFeatures = [];
// Loop through work orders
for (var wo in workorders) {
var startDate = wo["stormdate"];
var endDate = wo["surveydate"];
// Ensure both dates are not empty or null
if (!IsEmpty(startDate) && !IsEmpty(endDate)) {
// Calculate days to complete
var daysToComplete = DateDiff(endDate, startDate, "days");
// Only include work orders that took more than 7 days
if (daysToComplete > 2) {
// Add the feature to the filtered list
Push(
filteredFeatures,
{
attributes:
{
WorkOrderID: Text(wo["efscale"]),
InitiateDate: Date(startDate),
ActualFinishDate: Date(endDate),
DaysToComplete: Floor(daysToComplete)
}
}
);
}
}
}
var finaltable = {
fields: [
{
name: "WorkOrderID",
alias: "Work Order ID",
type: "esriFieldTypeString"
},
{ name: "InitiateDate", alias: "Initiate Date", type: "esriFieldTypeDate" },
{
name: "ActualFinishDate",
alias: "Actual Finish Date",
type: "esriFieldTypeDate"
},
{
name: "DaysToComplete",
alias: "Days To Complete",
type: "esriFieldTypeInteger"
}
],
geometryType: "",
features: filteredFeatures
};
return FeatureSet(finaltable);
... View more
02-18-2025
01:01 PM
|
0
|
4
|
2608
|
|
POST
|
You're building the array of filterFeatures, but you don't add that to finalTable. var finaltable = {
fields: [
{ name: "WorkOrderID", type: "esriFieldTypeString" },
{ name: "InitiateDate", type: "esriFieldTypeDate" },
{ name: "ActualFinishDate", type: "esriFieldTypeDate" },
{ name: "DaysToComplete", type: "esriFieldTypeInteger" }
],
geometryType: "",
features: filteredFeatures
};
return FeatureSet(finaltable);
... View more
02-18-2025
11:32 AM
|
0
|
6
|
2624
|
|
POST
|
And it would be helpful to see how your data is formatted and what you'd like the output to look like.
... View more
02-18-2025
06:10 AM
|
0
|
0
|
848
|
|
POST
|
You still have the option to open in Map Viewer Classic if you open the web map item and click the down arrow on the "Open in Map Viewer" button.
... View more
02-18-2025
06:05 AM
|
1
|
0
|
1302
|
|
POST
|
Your error comes from lines 14 and 15, where you need "esriFieldTypeString" instead of "esrifieldTypeString". Case matters! var portal = Portal('https://www.arcgis.com/');
var fs = FeatureSetByPortalItem(
portal,
'7bd678181312462faebc8d1077f8fc3a',
0,
[
'service'
],
false
);
var fsDict = {
'fields': [
{'name': 'service_type', 'alias': 'Type of Service', 'type': 'esriFieldTypeString'},
{'name': 'revenue', 'alias': 'Revenue', 'type': 'esriFieldTypeString'}
],
'geometryType': 'esriGeometryNull',
'features': []
};
var i = 0;
for (var f in fs) {
var income = IIF(f['service'] == "reinstallation", 150, 200)
fsDict.features [i++] = {
'attributes': {
'service_type': f.service,
'revenue': income
}
}
}
Console(fsDict.features)
return FeatureSet(fsDict)
... View more
02-17-2025
09:08 AM
|
0
|
1
|
1823
|
| 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 |
3 weeks ago
|