Hello,
I'm trying to create a feature set as the source for a table element, but my data expression gives the following error: 'Test execution error: Unknown Error. Verify test data.' I would greatly appreciate any help available. I'm very new to Arcade.
Solved! Go to Solution.
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)
Can you post this as code instead of an image? It's easier to do checking when we can copy the code to the Playground
Thank you so much for responding. The code is below:
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)
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)
Thank you so much! It works perfectly now. I really appreciate your help.