Concatenated Display Fields Not Displaying Correctly in Feature Layer (Bug Report)

130
2
04-29-2021 08:46 PM
HenryKo2
New Contributor III

We published a map service using 10.6.1 ArcGIS for Server (on Linux) where the label is symbolised by concatenating 3 fields:

[Road_Name] + " " + [Road_Type] + " - " + [Road_Number]

When we use this as a Feature Layer in ArcGIS API for JavaScript version 4.18.1 (with npm build), the labels show up as the following:

HenryKo2_0-1619753989765.png

That is, the word "concat" appears in the label, instead of "Prince Hwy - 0000001".

This issue does not appear if using Map Image Layer.

I tried various other ways e.g. using advanced functions, JScript / VBScript etc, no luck.

In addition, I tried to do the labelling in JavaScript code with LabelClass and labelExpressionInfo, the same issue happens.

I want to submit a bug report but there isn't an easy way to do so, hence the post here.

Can someone from Esri take a look please.

0 Kudos
2 Replies
Noah-Sager
Esri Regular Contributor

Hi @HenryKo2, I think the issue you are seeing is because MapImageLayer uses SQL for the labelExpression:

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#la...

Whereas FeatureLayer uses Arcade for the labelExpressionInfo:

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-LabelClass.html#la...

Arcade:

https://developers.arcgis.com/arcade/function-reference/

test-app to see it in action (concatenating labels with a FeatureLayer):

https://codepen.io/noash/pen/yLgmwxZ?editors=1000

 

0 Kudos
HenryKo2
New Contributor III

Thanks Noah-Sager for the reply.

I should clarify, we published the map service in ArcGIS for Server with the following, using ArcMap:

HenryKo2_0-1620084708482.png

Then we simply consume it as FeatureLayer in the JS app:
 
            this.layer = new FeatureLayer({
                url: ...,
                title: ...,
                popupEnabled: ...,
                visible: ...,
                popupTemplate: {...},
            });

 

The result we got is the screenshot I posted above where "concat" happens.

We don't do anything explicit or special with the labels in JS code. 

I would expect the labels to display correctly "out-of-box", regardless of SQL or Arcade expressions.

 

0 Kudos