Select to view content in your preferred language

Custom label or popup using expression

883
4
07-27-2022 03:04 AM
CrystalCowardin
Regular Contributor

I'm working in the new Map Viewer in Portal and I would like to create a custom label or expression I can use in the popup window.  I didn't see an option under labeling for anything custom so may have to be popup.  I am not an expert at writing expressions so need some help. 

This is my expression from ArcMap and would like it to look the same in Portal.

[LAND_VALUE_CURRENT] &vbCrLf& [PARCEL_ACREAGE] & " Acs" & vbCrLf& "$ "& Round ( [LAND_VALUE_CURRENT] / [PARCEL_ACREAGE], 0) & " Per Acre"

On the map, it looks like this: 

CrystalCowardin_0-1658916246353.png

 

4 Replies
berniejconnors
Frequent Contributor

Crystal,

        There is this Esri Support Article - https://support.esri.com/en/technical-article/000025694.  But there was also something mentioned at the Esri UC2022.  I can't remember if it was in an Arcade session or a Map Viewer session.  Unfortunately, new features just metioned at the UC2022 may not be available to you in your version of Portal.

Bernie.

CrystalCowardin
Regular Contributor

Arcade expressions are available in Portal for Pop Ups...I just don't know how to write it.

I'll take a look at the article.  Thanks

0 Kudos
KenBuja
MVP Esteemed Contributor

Your expression would look something like this

var value = $feature.LAND_VALUE_CURRENT;
var acreage = $feature.PARCEL_ACREAGE;
var calc = Round(value/acreage, 0);

//return value + TextFormatting.NewLine + acreage + ' Acs' + TextFormatting.NewLine + '$' + calc + ' Per Acre';
return `${value}${TextFormatting.NewLine}${acreage} Acs${TextFormatting.NewLine}$${calc} Per Acre`;

The first return uses the normal quotes and the second one uses Template Literals. They're sometimes easier to read. You can also use the Text formatting methods if you want the numeric values to include the thousand comma.

Text(value, '#,###')

berniejconnors
Frequent Contributor

Crystal,

        You got this.  The article makes it very clear how to code the formatting of your multi-line labels.  Please share an image of your completed labels when you are done.

Thanks,

Bernie.

0 Kudos