Select to view content in your preferred language

ArcGIS Dashboards Arcade Data Expression not working after update

2084
15
Jump to solution
11-13-2024 06:45 AM
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

 

15 Replies
RandyBonds_Jr_
Frequent Contributor

Yes! I have confirmed it's working for us as well. Thanks for the quick attention to this issue.

0 Kudos
JessicaLott_Dymaptic
Occasional Contributor

Hello!

We are starting to see this error as well. Could the bug have been reintroduced?

Thanks!

0 Kudos
RandyBonds_Jr_
Frequent Contributor

I'm not seeing it on my dashboard... it's working correctly

0 Kudos
LJackson29
Frequent Contributor

Our dashboards with data expressions are working as well.

0 Kudos
KerryKang
Frequent Contributor

my data expression seems working using 'FeatureSetByPortalItem' in the preview and editing mode, but not in the view mode. There are multiple widgets/ URL parameter working together with my data expression so I am not sure where the issue is coming from exactly.

 

KerryKang_0-1731623837323.png

 

0 Kudos
LJackson29
Frequent Contributor

@KerryKang The bug described above is specific to map image layers, so if you are using a feature service, your issue might be something different.

0 Kudos