Select to view content in your preferred language

Arcade expression with 2 fields

994
2
07-22-2020 01:05 PM
JenJoern
New Contributor

Was hoping to get help with an Arcade Calculator issue. I have two field names I am referencing and 4 possible outcomes to populate a new text field.

I have an integer field as well as a text field that is domain driven. The end result is a simple text return: (Pass, Fail, No Locate, Other). 

If the number field = 1, and domain field = Full, then = Pass

If the number field = 1, and domain field = Dim, then = Fail... and so on.

Any Arcade wizards out there willing to help? I made a couple rough attempts, but am having trouble with referencing 2 different fields.

Thanks!

Tags (2)
0 Kudos
2 Replies
KenBuja
MVP Esteemed Contributor

One problem you might be running into is when you're using a domain, you have to either make your evaluation with its label or use DomainName to use its code.

For example if DomainField is set up like

LabelCode
1Full
2Dim

then you'd either use

if ($feature.DomainField == 1)

or

if (DomainName($feature,'DomainField') == 'Full')‍‍

For your calculator, one way of evaluating your two variable would look something like this

if ($feature.NumberField == 1) {
  if ($feature.DomainField == 1) ‍‍{ // if (DomainName($feature,'DomainField') == 'Full')‍‍
    return 'Pass';
  } else if (if ($feature.DomainField == 2) ‍‍ { //if (DomainName($feature,'DominField') == 'Dim')‍‍
    return 'Fail';
  }
}
//etc‍‍‍‍‍‍‍‍
0 Kudos
JenJoern
New Contributor

Thank you Ken Buja‌, got it to work. 

0 Kudos