Arcade: Can you reference an existing expression in another expression?

196
4
10-25-2019 09:56 AM
Highlighted
Regular Contributor

Let's say I have {expression/expr0} written, and I want to write a new expression to use the same output but scrubbed a different way. Can I reference $feature.{expression/expr0}? That syntax doesnt work, but hopefully this is possible and I'm doing it wrong?

Tags (1)
4 Replies
Highlighted
Esri Regular Contributor

Hi Rob,

You can reference existing expressions in the Existing tab of the expression authoring window:

Hope that helps,

-Peter

Highlighted
New Contributor III

Hey Peter Klingman‌ - is there a way to just embed the name of the expression? I'm pretty new at using Arcade Expressions and the online documentation doesn't reference how to embed expressions in another expression.Thank you!

Highlighted
Esri Regular Contributor

Hi Nichole, it is not currently possible to reference the expression by name. You would need to select the existing expression from the right hand menu, and this will insert it into the expression that is currently being authored. For all intents and purposes it is the same as reusing the expression by name, albeit makes the script longer. Hope this helps!

-Peter 

Highlighted
New Contributor III

Hey Peter - I ended up figuring out the expression because the embedded code would not cooperate using the method you described. Thanks though!