Define labels using a function?

417
2
Jump to solution
05-23-2021 10:48 PM
Labels (1)
mody_buchbinder
Occasional Contributor

When you create a label in VBScript or python you can create a function (using the advance checkbox).

This does not exists for Arcade why?

The simple example is that I have an integer field.

If its value is above 100 I want my label to say "high"

If it is between 100 to 50 I want "medium" and if less then 50 I need "low"

How do I create such a label in Arcade.

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

Specify text for labels—ArcGIS Pro | Documentation

A label expression can either be a simple single line expression, or a more complex expression spanning multiple lines of code and making use of the parser's programming logic. Arcade enables complex expressions by default. When using Python, VBScript, or JScript, the Advanced checkbox must be checked and the code must be wrapped in a function to enable multi-line expressions.

It suggests to me that a function isn't needed by default, but is for the others.  Interesting difference if that is the case


... sort of retired...

View solution in original post

0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

Specify text for labels—ArcGIS Pro | Documentation

A label expression can either be a simple single line expression, or a more complex expression spanning multiple lines of code and making use of the parser's programming logic. Arcade enables complex expressions by default. When using Python, VBScript, or JScript, the Advanced checkbox must be checked and the code must be wrapped in a function to enable multi-line expressions.

It suggests to me that a function isn't needed by default, but is for the others.  Interesting difference if that is the case


... sort of retired...
0 Kudos
mody_buchbinder
Occasional Contributor

Hi Dan

The very last example in this long page show the point.

I looked it up but did not go al the way to the end...

I will give it a try 

Thanks

0 Kudos