Select to view content in your preferred language

ArcGIS Dashboards Arcade Data Expression not working after update

1325
15
Jump to solution
11-13-2024 06:45 AM
Labels (1)
LJackson29
Frequent Contributor

Hello -

I am working in ArcGIS Dashboards and have a data expression that is no longer working after the update last night. I am getting this error "Test execution error: layerId=1 provided for Map Service item. Verify test data." It is not clear what this error is - the layerid is correct. I am using a map image service pulled in from Enterprise Portal that has 3 layers. See my code below.

 

var port = Portal('https://www.arcgis.com');
var fs = filter(FeatureSetByPortalItem(
  port,'xxxxxxxxxxxxxxxx', 1,
  ['PH_PROJECTID', 'PH_PHASEID', 'PH_PHASENAME', 'PH_COMPLDATE', 'PH_STATUS', 'PH_PHASETYPE', 'PH_STREAMRESTORED_LFT', 'PH_WETLAND_AC', 'PH_FLOODPLAIN_AC', 'PH_CULVERTREPAIRED_FT', 'PH_SEDIMENTREMOVED_CY', 'PH_BASINSTORAGE_ACFT', 'PH_TREESPLANTED', 'PH_WAC', 'PH_SUBWATERSHED', 'PH_COMMUNITY1'],
  false),
  "PH_STATUS='07. Completed' AND (PH_PHASETYPE='1. DesCon' OR PH_PHASETYPE='2. SWIM' OR PH_PHASETYPE='3. Partner' OR PH_PHASETYPE='4. Parcel Acquisition')"
);

var out_dict = {
    fields: [
        {name: 'projectid', type: 'esriFieldTypeString'},
        {name: 'phaseid', type: 'esriFieldTypeString'},
        {name: 'phasename', type: 'esriFieldTypeString'},
        {name: 'phasetype', type: 'esriFieldTypeString'},
        {name: 'complyear', type: 'esriFieldTypeString'},
        {name: 'status', type: 'esriFieldTypeString'},
        {name: 'stream', type: 'esriFieldTypeDouble'},
        {name: 'wetland', type: 'esriFieldTypeDouble'},
        {name: 'floodplain', type: 'esriFieldTypeDouble'},
        {name: 'culvert', type: 'esriFieldTypeDouble'},
        {name: 'sediment', type: 'esriFieldTypeDouble'},
        {name: 'basin', type: 'esriFieldTypeDouble'},
        {name: 'trees', type: 'esriFieldTypeInteger'},
        {name: 'wac', type: 'esriFieldTypeString'},
        {name: 'subwatershed', type: 'esriFieldTypeString'},
        {name: 'community1', type: 'esriFieldTypeString'},
        {name: 'streamcat', type: 'esriFieldTypeString'},
        {name: 'wetlandcat', type: 'esriFieldTypeString'},
        {name: 'floodplcat', type: 'esriFieldTypeString'},
        {name: 'culvertcat', type: 'esriFieldTypeString'},
        {name: 'sedimentcat', type: 'esriFieldTypeString'},
        {name: 'basincat', type: 'esriFieldTypeString'},
        {name: 'treescat', type: 'esriFieldTypeString'},
    ],
    geometryType: '',
    features: []
}

// Iterate over each feature in the layer
for (var f in fs){
    
    Push(
        out_dict['features'],
        {attributes:
            {
                projectid: Text(f['PH_PROJECTID']),
                phaseid: Text(f['PH_PHASEID']),
                phasename: Text(f['PH_PHASENAME']),
                phasetype: Text(f['PH_PHASETYPE']),
                complyear: Year(f['PH_COMPLDATE']),
                status: Text(f['PH_STATUS']),
                stream: Number(f['PH_STREAMRESTORED_LFT']),
                wetland: Number(f['PH_WETLAND_AC']),
                floodplain: Number(f['PH_FLOODPLAIN_AC']),
                culvert: Number(f['PH_CULVERTREPAIRED_FT']),
                sediment: Number(f['PH_SEDIMENTREMOVED_CY']),
                basin: Number(f['PH_BASINSTORAGE_ACFT']),
                trees: Number(f['PH_TREESPLANTED']),
                wac: Text(f['PH_WAC']),
                subwatershed: Text(f['PH_SUBWATERSHED']),
                community1: Text(f['PH_COMMUNITY1']),
                streamcat: IIF(f['PH_STREAMRESTORED_LFT']>0, 'Yes', 'No'),
                wetlandcat: IIf(f['PH_WETLAND_AC']>0, 'Yes', 'No'),
                floodplcat: IIf(f['PH_FLOODPLAIN_AC']>0, 'Yes', 'No'),
                culvertcat: IIf(f['PH_CULVERTREPAIRED_FT']>0, 'Yes', 'No'),
                sedimentcat: IIf(f['PH_SEDIMENTREMOVED_CY']>0, 'Yes', 'No'),
                basincat: IIf(f['PH_BASINSTORAGE_ACFT']>0, 'Yes', 'No'),
                treescat: IIf(f['PH_TREESPLANTED']>0, 'Yes', 'No'),
            }
        }
    )
}

//Return populated out_dict as FeatureSet
var mos = FeatureSet(Text(out_dict))

return mos

 

1 Solution

Accepted Solutions
KathrynWalker
Esri Contributor

@LJackson29 this bug should now be fixed. Please let us know if you see behavior otherwise! 

View solution in original post

0 Kudos
15 Replies
Stephanie_F
Esri Contributor

Hi @LJackson29 I suggest working with Technical Support to report this https://support.esri.com/en-us/contact/report-bug

0 Kudos
LJackson29
Frequent Contributor

@Stephanie_F  Thanks - will do

0 Kudos
RandyBonds_Jr_
Frequent Contributor

We are having the same issue! I have opened a ticket with support, but wanted to let you know that you're not alone 🙂

My code for comparison: 

//get featureset from portal item

var fs = FeatureSetByPortalItem(
    Portal("https://gis.yakimawa.gov/portal/"),
    "ITEM_ID",
    0,
    [
      "CleanupDate",
      "ShoppingCart",
      "Tires",
      "Furniture",
      "Mattresses",
      "Appliances",
      "Electronics",
      "Graffiti",
      "Miscellaneous",
      "PressureWash",
      "Vacuum",
      "Incompletes"
    ],
    false
  );

  var choicesDict = {
    fields: [
      { name: "cleanupDate", type: "esriFieldTypeDate" },
      { name: "sumCategories", type: "esriFieldTypeDouble" }
    ],
    geometryType: "",
    features: []
  };

  // Split comma separated hazard types and store in dictionary.
  var i = 0;

  for (var ccfeature in fs) {
    choicesDict.features[i++] = {
      attributes:
        {
          cleanupDate: ccfeature["Cleanupdate"],
          sumCategories:
            ccfeature["ShoppingCart"] +
            ccfeature["Furniture"] +
            ccfeature["Mattresses"] +
            ccfeature["Appliances"] +
            ccfeature["Electronics"] +
            ccfeature["Tires"] +
            ccfeature["Graffiti"] +
            ccfeature["Miscellaneous"] +
            ccfeature["PressureWash"] +
            ccfeature["Vacuum"] +
            ccfeature["Incompletes"]
        }
    };
  }

  return FeatureSet(Text(choicesDict));

The error when I try to test:

 Test execution error: layerId=0 provided for Map Service item. Verify test data.

 

0 Kudos
LJackson29
Frequent Contributor

@RandyBonds_Jr_ Thanks for sharing - it always helps that there are others experiencing the same issue!

0 Kudos
KathrynWalker
Esri Contributor

Hi @LJackson29 and @RandyBonds_Jr_,

Thank you for reporting this behavior. An official bug has been logged for this: "BUG-000172239: Map Services are no longer able to be used as the reference item for Arcade's FeatureSetByPortalItem function in Map Viewer pop-ups or Dashboard data expressions following the ArcGIS Online November 2024 update". Please request that your cases be attached to this bug.

An identified short-term workaround is to add the map service's sublayer(s) individually as items to ArcGIS Online and reference their item IDs in the Arcade expression.

Thank you,
Katie 

RandyBonds_Jr_
Frequent Contributor

Thanks, the support person added it to my request yesterday.

0 Kudos
LJackson29
Frequent Contributor

@KathrynWalker  Thanks - I will have the support person add the bug when I we talk. Is there any timeline for a fix?

0 Kudos
KathrynWalker
Esri Contributor

@LJackson29 this bug should now be fixed. Please let us know if you see behavior otherwise! 

0 Kudos
LJackson29
Frequent Contributor

@KathrynWalker Yes, it is working again. Thanks so much for the quick turn around on this. 😊

0 Kudos