Select to view content in your preferred language

trouble with If then else statements in portal

629
3
Jump to solution
04-05-2024 10:32 AM
Laura_m_Conner
Regular Contributor

I am trying to label water lines for a web map that is untimely going to be used in a web app. I want the lines labeled with the diameter and the material abbreviated. The data for the mains does not have a field for the abbreviated materials. I am trying to use if-then-else statements to accomplish this. I have tried various ways, but the issue I am encountering is only the first statement is evaluated. When a line evaluates false, it does not evaluate the next if then else statement. This problem prevents me from getting the labels for all the mains working.
How can I write an if-then-else expression that will evaluate the next line when false? A general example or the name of the peculiar function will greatly help. Also, what language are these expressions written in? (my guess is arcade)

Notes
enterprise version: 10.6
portal version 10.6

Thanks

Laura

 

 

 

0 Kudos
1 Solution

Accepted Solutions
CarsonMorton
Regular Contributor

Use when. you can add as many cases as you need. just end with a final result if non of the cases are true

when($feature.thing == 50, "it is 50",
$feature.thing == 25, "it is 25",
"it is neither")

View solution in original post

0 Kudos
3 Replies
DanPatterson
MVP Esteemed Contributor

show your code


... sort of retired...
0 Kudos
Laura_m_Conner
Regular Contributor

I tried these so far...

 

The code I first tried was:

IIf($feature.MATERIAL == "Ductile Iron" , $feature.DIAMETER + "DIP", "Pass")

IIf($feature.MATERIAL == "Concrete (Non-Reinforced)" , $feature.DIAMETER + "CON", "Pass")

....

The "pass" is a place holder for going to the next line. I never figured out what that fuction was and I not certain there is one that can be used there for what I trying to do.

Then I tried   

if($feature.MATERIAL == "Ductile Iron" ){$feature.DIAMETER + "DIP"}
else ($feature.MATERIAL == "Concrete (Non-Reinforced)"{$feature.DIAMETER + "CON"}

...

Thanks

Laura

 

 

0 Kudos
CarsonMorton
Regular Contributor

Use when. you can add as many cases as you need. just end with a final result if non of the cases are true

when($feature.thing == 50, "it is 50",
$feature.thing == 25, "it is 25",
"it is neither")
0 Kudos