Dynamic Expressions

882
8
03-19-2021 08:25 AM
JonathanMcDougall
Occasional Contributor III

I realise this seems a very basic question, however, I can't for the life of me get an expression to work - I want to convert wind speed from m/s to mph.

{Wind Speed (m/s)}*2.2

All I get, when inserting the expression is the name of the expression.

 

It's driving me bonkers!

8 Replies
jcarlson
MVP Notable Contributor

Does it still give you the expression name on Live View, or if you preview the experience? I occasionally have an expression only display its name in the editing view, but it will work once I switch to the live view.

- Josh Carlson
Kendall County GIS
0 Kudos
JonathanMcDougall
Occasional Contributor III

I've tried live and published views, same result.

I've other expressions within the experience that calculates the difference in footfall over a day - that's works with count (field) - count (other field)

BrunoSousa1
New Contributor III

Hi Johnathan, 

Have you double checked if the column is in Number format? If it's text format I think calculations won't work. Also, when you insert the field in the expression, does it turn yellow or red?

JonathanMcDougall
Occasional Contributor III

Hi,

 

The field is a double and I've the widget linked to data, so it's not showing red. The wind speed field is showing yellow in the expression. dynexp.png

BrunoSousa1
New Contributor III

Is that layer Public? I could test it here...

TonghuiMing
Esri Contributor

Hi, @JonathanMcDougall -


{Wind Speed (m/s)}*2.2

All I get, when inserting the expression is the name of the expression.


Selected features.png

I am not sure what your app looks like, but to make the expression you configured work, you will need to select a feature so that the widget/app would know which data record to convert by the expression you set.

Notice that in the setting it says "Selected features" - I assume that you use this expression with either a Map, a List, or a Feature Info, etc. Try click on the features, and it will show.

 

If you want to set the expression to show even if there is no selection made, go to the data panel of this one that is being used, and check the "Empty selection" option, or even go in and configure it. It allows you to customize what you want the connected section to show if no selection is made:

Selected features_empty.png

You can refer to the details for empty selection here - https://doc.arcgis.com/en/experience-builder/build-apps/select-data.htm. Hope it helps.

 

Best,

Tonghui

DavidRasner1
New Contributor III

Thanks for the hint. I found this very confusing, it should be selected by default. 

Maybe related, when I use some math, it gives me a lot of decimals. Is there a way to format numbers?

DavidRasner1_0-1627732094847.png

 

 

0 Kudos
JonathanMcDougall
Occasional Contributor III

@DavidRasner1 

No, it's frustrating that we get so many decimal places. If I remember right, I put a suggestion on the Ideas page for dev.

0 Kudos