Hi everyone,
I am using Arcgis API for JS v4.13 to create a web application. I have a MapImageLayer created from a service url, which contains 4 sublayers:
var MyLayer = new MapImageLayer({
url: 'https://url/to//MapServer/',
sublayers: [
{
id: 5,
visible: true,
title: 'abc'
},
{
id: 4,
visible: true,
title: 'def'
},
{
id: 3,
visible: true,
title: 'ghi',
popupTemplate: customPopupThird
},
{
id: 1,
visible: true,
title: 'jkl',
popupTemplate: customPopupFourth
}
]
});
For my first popupTemplate, the arcade expression inside works, but for customPopupFourth, it doesn't work. Below is the popuptemplate that doesn't work.
title: 'Title for layer id 1',
outFields: ['*'],
expressionInfos: [
{
name: 'CurLandAreatoHect',
title: 'Current Land Area (ha)',
expression: '$feature.CurLandArea / 10000'
}
],
content: [
{
type: 'fields',
fieldInfos: [
{
fieldName: 'expression/CurLandAreatoHect'
}
]
}
]
The console from the browser throws up this error:
Logger.js:25 [esri.widgets.FeatureViewModel] query-required-fields Could not query required fields for the specified layer. Some fields will not be available.
and
Logger.js:25 [esri.widgets.FeatureViewModel] arcade-execution-error TypeError: Cannot read property 'length' of undefined
at t._fixDates (Feature.js:25)
at t.field (Feature.js:25)
at Object.member (arcadeCompiler.js:25)
at eval (eval at he (arcadeCompiler.js:25), <anonymous>:10:34)
at Generator.next (<anonymous>)
at arcadeCompiler.js:25
at new Promise (<anonymous>)
at Object.v [as create] (promiseUtils.js:25)
at Object.__awaiter (arcadeCompiler.js:25)
at mainBody (eval at he (arcadeCompiler.js:25), <anonymous>:9:14)
The resulting field in the table generated in the popup will be blank because of this error.
Thank you!