Converting VBScript to Arcade

1472
3
Jump to solution
02-22-2022 09:23 AM
DanaYoung
New Contributor III

So I have this VBScript in labeling that I'm trying to convert to Arcade, and it's the "(" and the ")" that I'm having issues in writing into the Arcade expression.

VBScribt expression: [GL_STR_FUL] & VBNEWLINE & "( " & [ALIAS_NAM] & " )"

 

Also.... is there an easy way to convert all VBScript into Arcade instead of going one my own in the expressions or a useful link to writing Arcade expressions since I'm pretty new at writing script in general....?

Thank you for your help!

 

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

I don't know that you'll find a reliable "conversion" tool, but Arcade's pretty simple.

To access feature attributes in Arcade, use the notation $feature.attribute or $feature['attribute'].

Concatenating text can be done with a "+" instead of "&". Or you can use a backtick string to pipe things into the text.

Basic concatenation:

$feature['GL_STR_FUL'] + TextFormatting.NewLine + '(' + $feature['ALIAS_NAM'] + ')

Backtick string:

`${$feature['GL_STR_FUL']}
(${feature['ALIAS_NAM']})`
- Josh Carlson
Kendall County GIS

View solution in original post

3 Replies
jcarlson
MVP Esteemed Contributor

I don't know that you'll find a reliable "conversion" tool, but Arcade's pretty simple.

To access feature attributes in Arcade, use the notation $feature.attribute or $feature['attribute'].

Concatenating text can be done with a "+" instead of "&". Or you can use a backtick string to pipe things into the text.

Basic concatenation:

$feature['GL_STR_FUL'] + TextFormatting.NewLine + '(' + $feature['ALIAS_NAM'] + ')

Backtick string:

`${$feature['GL_STR_FUL']}
(${feature['ALIAS_NAM']})`
- Josh Carlson
Kendall County GIS
jcarlson
MVP Esteemed Contributor

PS - https://github.com/Esri/arcade-expressions

You can find all kinds of Arcade expressions there, along with helpful explanations.

- Josh Carlson
Kendall County GIS
DanaYoung
New Contributor III

Thank you so much! This is very helpful and that's what I was missing the & to the +... no wonder it didn't work right.

0 Kudos