cmv-app icon indicating copy to clipboard operation
cmv-app copied to clipboard

example to use Arcade in a customized identify config file

Open ERS-Long opened this issue 3 years ago • 2 comments

Hi Tim,

Please see what is the issue with this function when i switched the Identify code to use Arcade.

I have a customized identify config code, the structure is something like

================================================================= define([a set of dojo modules], function (a set of names) { var formatters = { myIdentify_Method1: function(identifyResults) { //code here to prepare all the logic // //the problem is this function never got called } };

return { map: true, mapClickMode: true, mapRightClickMenu: true, identifyLayerInfos: true, identifyTolerance: 10, draggable: true, returnFieldName: true, returnUnformattedValues: true,

identifies : { layer1: { 0: { title: 'Gauges', useExpression: false, content: formatters.myIdentify_Method1 } } } })

Please help, Thanks!

ERS-Long avatar Aug 25 '20 15:08 ERS-Long

Hello @ERS-Long

Good to hear from you!

I see you're trying to use your formatter function with Arcade to set the content of the popup. Typical usage within CMV is to call that function for a specific field like this. I highlighted line 87 also because setting useExpression: false as you have done will not use an Arcade expression. To use arcade, you would set that to true or remove it completely since true is the default,

If you do want to use Arcade expression to set the entire popup content, I am not sure if that is supported by Esri or CMV. I have never tried it and would be surprised if it works.

As far as why your function is not called at all, I seem to recall there being a CMV bug that won't allow you to set the content using a function as you have done. I'm not finding my notes about it at the moment. Will look at it further.

tmcgee avatar Aug 26 '20 15:08 tmcgee

hi Tim,

Thanks a for your reply.

Yes, I was playing with Arcade to see what the benefit we can get out of it. But i still wants to keep the old function there. For right now, i just did a work around, if i need to use Arcade, i will load the new identify widget code, if not i switch it back. Just for now.

Stay safe!

ERS-Long avatar Aug 26 '20 18:08 ERS-Long