Select to view content in your preferred language

Use Custom Expressions in Arcade

128
4
Tuesday
N0MAD
by
New Contributor III

Howdy

In most of programming languages, we can import code from another file
I noticed that we can Custom Expression in Arcgis Map but i still wonder, how to use them

N0MAD_0-1720519301708.png

I created this expression, but is there any way to use it into an Arcade Script without putting the whole code ?

From now, i just copy paste the expression into the other one  but if i need to modify the expression, i need to go trough all my expressions

 

Is there a easier way ?

4 Replies
jcarlson
MVP Esteemed Contributor

Unfortunately, no. There is no way to reference an entire expression from another. In the expression builder, you can see a list of other expressions in us on the "Suggestions" tab. Clicking on any of them will let you view and copy the code into your current expression.

jcarlson_0-1720528185149.png

I don't know what exactly you're trying to do with Arcade, but if you want your popup to have multiple expression-based values in it, you might want to look into using an Arcade popup element. This lets you create entire field lists or complex text / HTML elements with a single expression.

- Josh Carlson
Kendall County GIS
N0MAD
by
New Contributor III

In my case, i have a list of candidats for an election, but i only have their names, so i have a 80 lines expression that take their names, and get from another list their political group, the group color, their percentages and this fat expression is later used into 4 expressions to make html to make the results more human readable (for instande, a diagram, a fancy display with their image, etc...
But that's sad that i'll need to put the first expression into all others juste to have a good view

jcarlson
MVP Esteemed Contributor

So, have you tried an Arcade popup? If you're using the expression to create some custom HTML, you can probably reduce the number of times the expression needs to be used.

What's one of the expressions look like? Any chance the map you're making these for is public?

- Josh Carlson
Kendall County GIS
0 Kudos
N0MAD
by
New Contributor III

I don't really know if i can publish it now, but yea, i already use Arcade popup like so:

N0MAD_0-1720534300744.png

But i really think that the lack of a function like "Import" or "Execute" is quite bad, like if Arcgis just used a more complex language suck as python or Javascript in Online Map, it could open so many new way to make maps (like without using SDK and make our own website with an Iframe)

 

Btw: If you have an idea how to apply the alias that i've set into the map to arcade, plz, help

0 Kudos