Converting VB Script for Labelling to Arcade

2448
14
Jump to solution
07-09-2019 11:57 AM
WilliamDelmar
New Contributor II

I have the following VB Script expression for labeling hatches. It worked just fine in ArcMap. As I am now using ArcGIS Pro, I would like some help converting it to Arcade.

Function FindLabel ( esri__measure )

segLen = esri__measure

if  right(int((segLen *3.2808399)),2) = 0 then

  lblStation= int((segLen *3.2808399)/100) & "+00"

else

  lblStation = int((segLen *3.2808399)/100) & "+" &  right(int(segLen *3.2808399),2)

end if

 

  FindLabel = lblStation

 

End Function

0 Kudos
14 Replies
WilliamDelmar
New Contributor II

I have tried a second attempt. I hope that this removed the issue of pointing to our SQL Server.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi William Delmar ,

I was able to connect to the data and I see what you mean. The field reference I proposed has a fixed reference to the length of the line. There is a special reference that points to the measurement: $measure.

Your code would look like this:

var segLen = Round($measure * 3.2808399, 0);
return Round((segLen - (segLen % 100)) / 100, 0) + Text(segLen % 100, "+00");

Resulting in:

XanderBakker
Esri Esteemed Contributor

Maybe a small suggestion and change the interval to: 7.6199999884176 (25 feet in meters):

WilliamDelmar
New Contributor II

That should do it.

Thank you for your assistance.

0 Kudos
XanderBakker
Esri Esteemed Contributor

Hi William Delmar ,

You are welcome. If it turns out that it works for you, could you mark the post that answered your question as the correct one? Thanks!

0 Kudos