AnsweredAssumed Answered

Replace a number with a string in an Arcade Expression

Question asked by a.hirschi-wyssesri-rw-esridist Employee on Dec 21, 2017
Latest reply on Aug 21, 2018 by Yankito

I would like to see in my pop up e.g. "N/A" for all 0 values in a numeric field trying to do:

 

var salinity = $feature.d_sal_max;

IIF(salinity == 0,'N/A',salinity);

 

This leaves all 0 values empty (instead of showing "N/A") in the pop up and returns the actual value for all other values. Putting ' ' around the 0 doesn't make a difference.

 

The Expression:

var salinity = $feature.d_sal_max;

Replace(salinity, 0, 'N/A');

 

Replaces all 0 with "N/A", meaning "0.111" will appear as "N/A.111".

 

Any ideas?

 

Thanks,

Annina

Outcomes