Select to view content in your preferred language

Why Arcade expressions work in one map viewer but not another

906
4
09-19-2022 08:40 AM
DanaYoung
Regular Contributor

I created this expression via Arcade in Pro for one of my label classes

"$feature.GL_STR_FUL + TextFormatting.NewLine + $feature.ALIAS_NAM;"

when sharing it to AcrOnline it works just fine within the new map viewer; however, when I created a web app with WAB, I noticed the map viewer this uses is the "Map Viewer Classic" and not all my expressions are read, only the one, which is the one above. This is fine, since it seems  all my labels are still drawing; however the alias field is not below the "GL_STR_FUL" field like I had it written out. Can someone shed some light why my labels are not populating on separate lines and are being drawn as one single line? Also, if someone knows why all my label classes can be seen and read through the new map viewer but not through classic viewer? And also why does WAB not use the new map viewer? I have played around with Experience Builder, but unfortunately this web application doesn't function the way I need it to like WAB does. Thanks in advanced.

0 Kudos
4 Replies
KenBuja
MVP Esteemed Contributor

This all comes down to the difference between the ArcGIS API for JavaScript version 3.x and 4.x. 3.x can't do certain things, like render the page breaks using "NewLine", that 4.x can do. Map Viewer classic was written in 3.x, while the new Map Viewer uses the 4.x version.

WAB was written using 3.x and will not be upgraded to 4.x. It can only use the Map Viewer Classic version of the web maps. Experience Builder is written in 4.x and uses the new Map Viewer, but unfortunately doesn't yet have all the functionality that's found in WAB.

DanaYoung
Regular Contributor

Thank you for explaining that. This makes sense, but is also a bit frustrating. Sigh. Would a different expression or script language be better to write in to get it to recognize a page break?

0 Kudos
KenBuja
MVP Esteemed Contributor

Not that I know of. There was several attempts to see if there were other ways of having a line break in a label using the Map Viewer Classic, but none of them worked.

DanaYoung
Regular Contributor

I see, well thank you again for responding.

0 Kudos