# Simple Arcade Expressions

488
4
Jump to solution
02-27-2020 04:05 PM
New Contributor II

Can you call the results from an arcade expression for use in another expression? This is for collector use.

Tags (1)
1 Solution

Accepted Solutions
Esri Esteemed Contributor

That makes sense. However, I'm afraid that if you want to have return both the ArcadeChemicalCost and  ArcadeTotalCost, you will have to include the code for ArcadeChemicalCost in the ArcadeTotalCost expression.

The if else statement can probably be simplified using a dictionary or a when statement.

4 Replies
Esri Esteemed Contributor

An arcade expression (when dynamic like in a pop-up) does not have any knowledge of the existence of that any other Arcade expression results. When you execute the expression in a field calculation you generate a physical result and a next Arcade expression can have access to that result.

Can you provide an example of what you are trying to establish?

New Contributor II

I have a field with roughly 15 coded value domains for chemicals a forester can choose for a project. I use an If Else statement to get the cost for the the chemical that's chosen by the forester so that's now a new Arcade in memory field called ArcadeChemicalCost. I also have a rate field where the forester will enter a number. I'd like to have another Arcade expression that calls the Arcade cost and multiplies it by the rate to populate an Arcade total cost. ArcadeChemicalCost * Rate = ArcadeTotalCost. I know I can string a bunch of code together to get the result but I want to avoid writing more code than I have to. I wasn't sure if this functionality exists or not. I hope my gibberish makes sense. Thanks for looking at this.

Esri Esteemed Contributor

That makes sense. However, I'm afraid that if you want to have return both the ArcadeChemicalCost and  ArcadeTotalCost, you will have to include the code for ArcadeChemicalCost in the ArcadeTotalCost expression.

The if else statement can probably be simplified using a dictionary or a when statement.

New Contributor II

I was afraid of that but thought I would check just in case. Thanks for the help and quick response!!!