Hello, I'm very rusty with my Arcade abilities. Crash course: I have a table with 3 columns, I want my expression to take the values on 2 of them, divide them, and then put the result in a 3rd column.
The images attached are my attempt at this basic expression, and the error message that is thrown every time I try to run it. When I do the test one's, it says no errors and I'm stumped now. Any help is greatly appreciated!
Solved! Go to Solution.
Solution: Double Check your data types before posting for help. I was trying to divide a Double by a String. Thanks for the help all!
First thought: Does your dataset contain any null values in either the first or second column? Does it contain any zeroes in the second column?
Try this modification to see if it works:
var numerator = $feature.B01003_001E;
var denominator = $feature.ALAND_SQKM;
if (IsEmpty(denominator) || denominator == 0)
{
if (IsEmpty(numerator) || numerator == 0)
return 0
else
return null
}
return numerator / denominator
This for sure - Usually if I have something like this in a pop up, I will output all results as text and create exception messages for those div/0 and NaN errors.
Nope, same error message.
Where are you attempting to implement this? What App?
What kind of table are you using this in? Is this in a Data Expression for a Dashboard?
This table is a hosted feature layer view. I have the population and the land area from 2017 and I'm trying to update the population value to 2022 in the pop density column. Then this data will be used in a dashboard once everything is set up.
Solution: Double Check your data types before posting for help. I was trying to divide a Double by a String. Thanks for the help all!