|
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
|
593
|
|
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
|
2811
|
|
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
|
2824
|
|
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
|
2883
|
|
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
|
681
|
|
POST
|
It's probably better to submit your feedback through the Basemap feedback map.
... View more
09-18-2025
05:47 AM
|
1
|
0
|
996
|
|
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
|
938
|
|
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
|
1460
|
|
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
|
757
|
|
POST
|
You can use an Arcade element to do this. In this example I am testing whether a feature has the attribute "Fish and Benthic" (line 14). This field has a domain, so I have to get the Domain Name ( line 12). If the feature does have that attribute, I want the display to contain the five fields in the line 16. Otherwise, it will contain the three fields in line 22. var fields = Schema($feature).fields;
var attributes = {};
var fieldInfos = [];
function fieldTest(fieldList, fieldName, fieldAlias) {
if (Includes(fieldList, fieldAlias)) {
attributes[fieldalias] = $feature[fieldName];
Push(fieldInfos, { fieldName: fieldAlias });
}
}
var code = DomainName($feature, "Survey");
for (var i in fields) {
if (code == "Fish and Benthic")
fieldTest(
["Site ID", "Fish Status", "Fish Date", "Benthic Status", "Benthic Date"], //the list of fields you'd like if the feature has this attribute
fields[i].name,
fields[i].Alias
);
else
fieldTest(
["Site ID", "Fish Status", "Fish Date"], //the list of fields you'd like if the feature doesn't have that attribute
fields[i].name,
fields[i].alias
);
}
return { type: "fields", fieldInfos: fieldInfos, attributes: attributes }; These are what the two popups look like
... View more
09-10-2025
12:02 PM
|
2
|
0
|
821
|
|
POST
|
Unfortunately, this is not something that can be directly done through Advanced formatting in the Values tab. This is because the Arcade code in there only works with individual rows and not the entire dataset. You would have to create an additional field, which can be done with Arcade in a data expression that powers the table. Then you can use the value for the field to highlight the cell with Advanced formatting with Arcade. This code adds the extra UniqueCount column to your dataset. It does run slowly, but I don't know if that was due to network issues we seem to be having today. I'll have to do some more testing to see if I can make it more efficient. var fs = FeatureSetByPortalItem(
Portal("your Portal"),
"yourItem",
0,
false
);
var uniqueField = "your field";
var grouped = GroupBy(
fs,
uniqueField,
{ name: "Count", expression: "1", statistic: "COUNT" }
);
var fields = Schema(fs)["fields"];
Push(fields, { name: "UniqueCount", type: "esriFieldTypeSmallInteger" });
var temp_dict = {
fields: fields,
geometryType: "",
features: []
};
for (var f in fs) {
var attrs = {};
var value;
for (var attr in f) {
attrs[attr] = f[attr];
if (attr == uniqueField) {
value = f[attr];
}
}
var sql = `${uniqueField} = ${value}`;
//var sql = `${uniqueField} = '${value}'` // if uniqueField is a text field
attrs.UniqueCount = First(Filter(grouped, sql)).Count;
Push(temp_dict["features"], { attributes: attrs });
}
return FeatureSet(temp_dict); You don't need to add the UniqueCount field to the Value fields when setting up the table, but you'll use that field in the Advanced formatting tab. In this example, since all the Depth_ft values in my test table have multiple instances, I'm highlighting those that have more than 10 instances in line 1 var bgColor = iif ($datapoint.UniqueCount > 10, '#ff0000', '#ffffff')
return {
cells: {
FIELD_ID: {
displayText : Text($datapoint.FIELD_ID),
textColor: '',
backgroundColor: '',
textAlign: 'right',
iconName: '',
iconAlign: '',
iconColor: '',
iconOutlineColor: ''
},
LAT: {
displayText : Text($datapoint.LAT),
textColor: '',
backgroundColor: '',
textAlign: 'right',
iconName: '',
iconAlign: '',
iconColor: '',
iconOutlineColor: ''
},
LONG: {
displayText : Text($datapoint.LONG),
textColor: '',
backgroundColor: '',
textAlign: 'right',
iconName: '',
iconAlign: '',
iconColor: '',
iconOutlineColor: ''
},
DEPTH_FT: {
displayText : Text($datapoint.DEPTH_FT),
textColor: '',
backgroundColor: bgColor,
textAlign: 'right',
iconName: '',
iconAlign: '',
iconColor: '',
iconOutlineColor: ''
},
}
} That yields this table
... View more
09-08-2025
01:00 PM
|
0
|
0
|
519
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-04-2025 06:39 AM | |
| 1 | 2 weeks ago | |
| 1 | 04-10-2026 12:01 PM | |
| 1 | a month ago | |
| 1 | 10-11-2023 06:18 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|