Select to view content in your preferred language

Test execution error: Unknown Error. Verify test data.

195
4
Jump to solution
02-14-2025 06:13 AM
Labels (1)
PlANNADMIN
Emerging Contributor

 

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.

Arcade expression.PNG

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

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 solution in original post

0 Kudos
4 Replies
KenBuja
MVP Esteemed Contributor

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

0 Kudos
PlANNADMIN
Emerging Contributor

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)

 

 

 

 

0 Kudos
KenBuja
MVP Esteemed Contributor

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)

 

0 Kudos
PlANNADMIN
Emerging Contributor

Thank you so much! It works perfectly now. I really appreciate your help.

0 Kudos