VBS Label Expression To Arcade Or Python

641
2
Jump to solution
03-05-2019 11:27 AM
HushamMohamed
Occasional Contributor

I have the following VB Script expression for labeling, I am not getting the right blue color. I am using ArcGIS Pro,  same expression worked just fine in ArcMap.

I would like some help converting it to Arcade or Python.

Function FindLabel ( [ABCDEFGH_New.DesceasedName],[ABCDEFGH_New.ownerName],[ABCDEFGH_New.all_spaceid] )
if (FindLabel = [ABCDEFGH_New.DesceasedName]<>"") then
FindLabel = "<CLR black='255'><FNT size = '6'>" + [ABCDEFGH_New.DesceasedName] + "</FNT></CLR>"+ vbnewline + "<CLR red='115' green='38' blue='0'><BOL>" +[ABCDEFGH_New.all_spaceid] + "</BOL></CLR>"

ElseIf (FindLabel =IsNull([ABCDEFGH_New.DesceasedName] ) )Then
FindLabel= "<CLR blue='255'><FNT size = '6'>" + [ABCDEFGH_New.ownerName] + "</FNT></CLR>" + vbnewline + "<CLR red='115' green='38' blue='0'><BOL>" +[ABCDEFGH_New.all_spaceid] + "</BOL></CLR>"
Else
FindLabel ="<CLR red='115' green='38' blue='0'><BOL>" +[ABCDEFGH_New.all_spaceid] + "</BOL></CLR>"

End If

End Function‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
1 Solution

Accepted Solutions
XanderBakker
Esri Esteemed Contributor

You could try this with Arcade, although I don't have data to test this on:

var DesceasedName = $feature.DesceasedName;
var ownerName = $feature.ownerName;
var all_spaceid = $feature.all_spaceid;

var label = "";

if (DesceasedName != "") {
label = "<CLR black='255'><FNT size = '6'>" + DesceasedName + "</FNT></CLR>"+ TextFormatting.NewLine + "<CLR red='115' green='38' blue='0'><BOL>" + all_spaceid + "</BOL></CLR>";
} else if (IsEmpty(DesceasedName)) {
label = "<CLR blue='255'><FNT size = '6'>" + ownerName + "</FNT></CLR>" + TextFormatting.NewLine + "<CLR red='115' green='38' blue='0'><BOL>" + all_spaceid + "</BOL></CLR>";
} else {
label ="<CLR red='115' green='38' blue='0'><BOL>" + all_spaceid + "</BOL></CLR>";
}

return label;

View solution in original post

2 Replies
XanderBakker
Esri Esteemed Contributor

You could try this with Arcade, although I don't have data to test this on:

var DesceasedName = $feature.DesceasedName;
var ownerName = $feature.ownerName;
var all_spaceid = $feature.all_spaceid;

var label = "";

if (DesceasedName != "") {
label = "<CLR black='255'><FNT size = '6'>" + DesceasedName + "</FNT></CLR>"+ TextFormatting.NewLine + "<CLR red='115' green='38' blue='0'><BOL>" + all_spaceid + "</BOL></CLR>";
} else if (IsEmpty(DesceasedName)) {
label = "<CLR blue='255'><FNT size = '6'>" + ownerName + "</FNT></CLR>" + TextFormatting.NewLine + "<CLR red='115' green='38' blue='0'><BOL>" + all_spaceid + "</BOL></CLR>";
} else {
label ="<CLR red='115' green='38' blue='0'><BOL>" + all_spaceid + "</BOL></CLR>";
}

return label;

View solution in original post

HushamMohamed
Occasional Contributor

Thank you ..  it worked perfect.