IF function help

Hello, Sorry to bother the experts with my remedial questions, but I’m struggling with what I think is a simple issue.

I have a column, WarrantOtherJurisdiction that is a simple Enum field type with “YES” or “NO” possible responses. I have set the initial value of the column to be “NO”, as this is a situation that almost never happens. The next column, WarrantJurisdiction is also a Enum field type and list all of the counties in the State of Illinois with the addition of “None” and “IDJJ Parole”.

If WarrantOtherJurisdiction = “NO”, then WarrantJurisdiction should = “None”. If WarrantOtherJurisdication = “YES”, then the user should be able to select one of the Counties in the WarrantJurisdiction list. My expression,

If([WarrantOtherJurisdiction]=“NO”,None," ") within App formula

works correctly to indication “None” when WarrantOtherJurisdiction = “NO”, but does not allow the user to select from the list when WarrantOtherJurisdiction = “YES”. Your assistance is much appreciated!

Thank you!

Are these options defined as Values in the Type Details of the Enum column? Or do you generate the options in some other way?

image

1 Like

These options are defined as values like the example you provided, I included a snip below:

I hope this helps.

1 Like

Thanks, that’s what I was looking for.

First off, you won’t be using App formula here. With App formula, the user will never have the option to enter data. Instead, you’ll use Valid If to produce an error if the response isn’t as you allow. Typically, you’d put the Valid If expression on the column that occurs later in the form.

My guess is you want a setup like:

WarrantOtherJurisdiction

  • Required?: ON

  • Initial value: "NO"

WarrantJurisdiction

  • Valid If:

    SWITCH(
      [WarrantOtherJurisdiction],
      "NO", ([_THIS] = "None"),
      "YES", ([_THIS] <> "None"),
      TRUE
    )
    
  • Required?: ON

  • Initial value: IFS(("NO" = [WarrantOtherJurisdiction]), "None")

  • (Optional) Editable?:

    NOT(
      AND(
        ("None" = [_THIS]),
        ("NO" = [WarrantOtherJurisdiction])
      )
    )
2 Likes

While I dont completely understand the SWITCH expression, this solution has done the trick. Thank you!

2 Likes
1 Like