|
POST
|
That code should be var features = FeatureSetByName($map, 'Kartirane geoloske jedinice', ['PreferisanaStarost'], true);
Distinct(features, 'PreferisanaStarost');
... View more
09-23-2025
09:52 AM
|
0
|
0
|
239
|
|
POST
|
When posting code, please use the "Insert/edit code sample" button. It's easier to read and copy the code. A data expression must return a FeatureSet. Your code just returns an array of text strings. // Portal URL
var portalURL = "https://gis.(COMPANY_NAME).com/portal";
// Feature Layer ItemID
var layerItemID = "itemID";
// Layer index (usually 0)
var layerIndex = 0;
// Fields to include
var fields = ["T4PERMIT", "COMMODITY1", "OD", "Length_Miles"];
// Get FeatureSet from portal item
var fs = FeatureSetByPortalItem(
Portal(portalURL),
layerItemID,
layerIndex,
fields,
false
);
var grouped = GroupBy(
fs,
["T4PERMIT", "COMMODITY1", "OD"],
[{ name: "TotalMileage", expression: "Length_Miles", statistic: "SUM" }]
);
var finalResults = [];
for (var permit in Distinct(grouped, "T4PERMIT")) {
var permitVal = permit["T4PERMIT"];
var permitGroup = Filter(grouped, "T4PERMIT = @permitVal");
var textBlock = "<b>T4 Permit:</b> " + permitVal + "<br>";
for (var comm in Distinct(permitGroup, "COMMODITY1")) {
var commVal = comm["COMMODITY1"];
textBlock += " • <b>Commodity:</b> " + commVal + "<br>";
var commGroup = Filter(permitGroup, "COMMODITY1 = @commVal");
for (var row in commGroup) {
textBlock += "  ◦ <b>OD:</b> " +
row["OD"] +
" – <b>Mileage:</b> " +
Round(row["TotalMileage"], 2) +
"<br>";
}
}
Push(finalResults, { attributes: { Permits: textBlock } });
}
return FeatureSet(
{
fields: [{ name: "Permits", type: "esriFieldTypeString" }],
features: finalResults
}
); Using my test data, the code produces this list
... View more
09-23-2025
08:38 AM
|
1
|
5
|
655
|
|
POST
|
This goes back to my previous post How you get the features variable depends on where you're using the Arcade code. It could be using the variable $datastore or $layer. Or you might need to get it from a function like FeatureSetByName or FeatureSetByPortalItem What happens when you use "$datastore"?
... View more
09-23-2025
08:16 AM
|
0
|
0
|
245
|
|
POST
|
The Distinct function for FeatureSets has the syntax Distinct(features, fields) with the "features" variable being a FeatureSet and the "fields" variable being either a single field name or an array of field names. How you get the features variable depends on where you're using the Arcade code. It could be using the variable $datastore or $layer. Or you might need to get it from a function like FeatureSetByName or FeatureSetByPortalItem What do you get if you use this in your code? Distinct($layer, "Peferisana starost")
... View more
09-19-2025
09:48 AM
|
0
|
0
|
1118
|
|
POST
|
What are you trying to do with this code? This affects what profile variables and functions you're able to use in your code. For example, labeling and visualization gives you a very limited set of profile variables and function bundles for efficiency reasons, whereas field calculations and popups give you more. In any case, you can't use "$Kartirane geoloske jedinice", since that is not a FeatureSet variable.
... View more
09-19-2025
06:03 AM
|
0
|
0
|
1131
|
|
POST
|
You're using the incorrect syntax for the Distinct function for a FeatureSet. It should be Distinct($layer, 'fieldName')
//or
Distinct($layer, ['fieldName1', 'fieldName2'])
... View more
09-18-2025
10:54 AM
|
2
|
0
|
1190
|
|
POST
|
There are a couple of ways to do that. You can put a simple IIf function in the backgroundColor property to change it if it's a certain value. return {
cells: {
Portfolio_1: {
displayText : Text($datapoint.Portfolio_1),
textColor: '',
backgroundColor: iif($datapoint.Portfolio_1 == 1, "#ff0000",""),
textAlign: 'right',
iconName: '',
iconAlign: '',
iconColor: '',
iconOutlineColor: ''
}, which will give you this If you want to apply that logic to several columns, a better way would be to use a function that determines whether the cell should have a red background color, using the value of the $datapoints of the various columns. function bgColor(input) {
if (input == 1) return "#ff0000"
}
return {
cells: {
Portfolio_1: {
displayText : Text($datapoint.Portfolio_1),
textColor: '',
backgroundColor: bgColor($datapoint.Portfolio_1),
textAlign: 'right',
iconName: '',
iconAlign: '',
iconColor: '',
iconOutlineColor: ''
},
Portfolio_2: {
displayText : Text($datapoint.Portfolio_2),
textColor: '',
backgroundColor: bgColor($datapoint.Portfolio_2),
textAlign: 'right',
iconName: '',
iconAlign: '',
iconColor: '',
iconOutlineColor: ''
},
Portfolio_3: {
displayText : Text($datapoint.Portfolio_3),
textColor: '',
backgroundColor: bgColor($datapoint.Portfolio_3),
textAlign: 'right',
iconName: '',
iconAlign: '',
iconColor: '',
iconOutlineColor: ''
},
Portfolio_4: {
displayText : Text($datapoint.Portfolio_4),
textColor: '',
backgroundColor: bgColor($datapoint.Portfolio_4),
textAlign: 'right',
iconName: '',
iconAlign: '',
iconColor: '',
iconOutlineColor: ''
},
Portfolio_5: {
displayText : Text($datapoint.Portfolio_5),
textColor: '',
backgroundColor: bgColor($datapoint.Portfolio_5),
textAlign: 'right',
iconName: '',
iconAlign: '',
iconColor: '',
iconOutlineColor: ''
},
}
} which results in this
... View more
09-18-2025
10:43 AM
|
1
|
0
|
234
|
|
POST
|
It's probably better to submit your feedback through the Basemap feedback map.
... View more
09-18-2025
05:47 AM
|
1
|
0
|
328
|
|
POST
|
There is no "Add data" button on the left pane of the current AGOL Dashboard. It does have an "Analytics" button. Are you thinking of Experience Builder or Web AppBuilder with their "Add Data" buttons?
... View more
09-17-2025
07:05 AM
|
2
|
1
|
487
|
|
POST
|
Web AppBuilder, which uses JavaScript 3.x, doesn't support Group Layers, since they were introduced with JavaScript 4.x. To maintain group layers, you have to use Experience Builder. The only way to use grouping in Web AppBuilder would be to organize the services into groups in ArcGIS Pro and publish the map in ArcGIS Enterprise (not ArcGIS Online).
... View more
09-16-2025
09:22 AM
|
1
|
1
|
826
|
|
POST
|
When posting code, please use the "Insert/edit code sample" button. It makes reading your code much easier. I don't know why it's returning empty attributes for those fields. Have you checked the FeatureSet to see if there are records with no values in the attributes? The code returns the fields as they are ordered in the FeatureSet. To use a custom order, use this code var fields = Schema($feature).fields;
var attributes = {};
var fieldInfos = [];
var fieldList;
if ($feature.UNIT_PI_AF == "Single") {
fieldList = ["Site ID", "Unit PI AF", "Pressure URL", "Battery URL", "P1 Pressure", "P1 High High Alarm", "P1 High Alarm", "P1 High Alarm (Derived)", "P1 Low Alarm", "P1 Low Alarm (Derived)", "P1 Low Low Alarm", "Last Update PI"];
} else {
fieldList = ["Site ID", "Unit PI AF", "Pressure URL", "Battery URL", "P1 Pressure", "P1 High High Alarm", "P1 High Alarm", "P1 High Alarm (Derived)", "P1 Low Alarm", "P1 Low Alarm (Derived)", "P1 Low Low Alarm", "P2 Pressure", "P2 High High Alarm", "P2 High Alarm", "P2 High Alarm (Derived)", "P2 Low Alarm", "P2 Low Alarm (Derived)", "P2 Low Low Alarm", "Last Update PI"];
}
for (var j of fieldList) {
for (var i in fields) {
if (fields[i].name == j || fields[i].alias == j) {
attributes[fields[i].alias] = $feature[fields[i].name];
Push(fieldInfos, { fieldName: fields[i].alias });
}
}
}
return { type: "fields", fieldInfos: fieldInfos, attributes: attributes };
... View more
09-12-2025
06:50 AM
|
0
|
0
|
432
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a week ago | |
| 2 | a week ago | |
| 1 | 11-18-2025 12:30 PM | |
| 2 | 11-18-2025 06:53 AM | |
| 1 | 11-17-2025 06:38 AM |
| Online Status |
Offline
|
| Date Last Visited |
Tuesday
|