Create an if or iif statement for Details or List

1206
11
Jump to solution
02-22-2022 06:52 AM
RobertBorchert
Frequent Contributor III

I am wondering if it is possible to create an "if" or "iif" statement in a dashboard.

More specifically in Details or List.

I have tried a variety of options.

var cracking = $feature.FOUNDATIONCRACKING:
iif(cracking = 'Yes', 'Var1','Var2')

iif($feature.FOUNDATIONCRACKING = 'Yes', 'Var1','Var2')

We are using Enterprise and Portal

The information is coming from a Survey and is stored as part of a feature.

My intent for the results of this is when a answer is an aberration that I can make the font red. 

In this example FOUNDATIONCRACKING is a question as to whether or not the foundation is cracking. If the answer is Yes I want to do something like this for the results of the "if" statement     

<font color='red'>FOUNDATIONCRACKING</FONT>,FOUNDATIONCRACKING

 

0 Kudos
1 Solution

Accepted Solutions
jcarlson
MVP Esteemed Contributor

What version of Enterprise? In more recent versions where Arcade is available in Dashboards, this is fairly simple. In the Advanced formatting area, just use the expression you've given to create a "font color" variable, and pass that into the returned dictionary.

jcarlson_2-1645542503752.png

 

If you are on an earlier version, there's no way to accomplish this without a static field value, unfortunately.

- Josh Carlson
Kendall County GIS

View solution in original post

11 Replies
jcarlson
MVP Esteemed Contributor

What version of Enterprise? In more recent versions where Arcade is available in Dashboards, this is fairly simple. In the Advanced formatting area, just use the expression you've given to create a "font color" variable, and pass that into the returned dictionary.

jcarlson_2-1645542503752.png

 

If you are on an earlier version, there's no way to accomplish this without a static field value, unfortunately.

- Josh Carlson
Kendall County GIS
RobertBorchert
Frequent Contributor III

We are at the newest version.  

Maybe I am entering it in the wrong place.  I wrote it just like your example and this is what I get. 

RobertBorchert_0-1645543473805.png

 

0 Kudos
jcarlson
MVP Esteemed Contributor

Can you share the Arcade expression you're using? That text shouldn't appear unless it's somehow within the main return statement.

- Josh Carlson
Kendall County GIS
0 Kudos
RobertBorchert
Frequent Contributor III

var cracking = $datapoint.['FOUNDATIONCRACKING']:
var f_col = iif(cracking == 'Yes','Red', '')
return {
textColor: f_col
}

0 Kudos
RobertBorchert
Frequent Contributor III

And specifically where in the List or Details should I be pasting it?

0 Kudos
jcarlson
MVP Esteemed Contributor

In the advanced formatting code block. You have to enable advanced formatting for it to appear.

- Josh Carlson
Kendall County GIS
0 Kudos
RobertBorchert
Frequent Contributor III

Ahh that could be part of my problem. I don't have the option for Advanced formatting in Dashboards Classic.

it is there for the new dashboards.

We cannot use new Dashboards until ESRI fixes a bug where thumbnails do not show up in the dashboard

I went and activated it in a new dashboard and will try from there.

If the following syntax correct

var cracking = $datapoint.['FOUNDATIONCRACKING']:
var f_col = iif(cracking == 'Yes','Red', '')
return {
textColor: f_col
}

 

  • Defect ID: BUG-000146647
  • Synopsis: Feature Service Attachment preview is not displayed on the Details element widget in ArcGIS Dashboard
  • Status: In Review

 

0 Kudos
jcarlson
MVP Esteemed Contributor

Ah, right! I should have asked, I forget that there are two Dashboards tools at the moment.

- Josh Carlson
Kendall County GIS
0 Kudos
RobertBorchert
Frequent Contributor III

Version:  10.9.1 (build 28388) is our server version

 

0 Kudos