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
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 ?
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.
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.
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
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?
I don't really know if i can publish it now, but yea, i already use Arcade popup like so:
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