Help with Valid If required

Hi folks,

I need a little help with a form Iโ€™ve created. One of the questions is of type enumlist however I donโ€™t want respondents to be able to select all of the options.

The question Iโ€™m asking is โ€˜Have you made any of the following via the app:โ€™

The options are;
Connections with a colleague
Buddy with a colleague
None

So basically if the respondent selects โ€˜Noneโ€™ then they shouldnโ€™t be able to select either of the other options and vice versa. Iโ€™ve read that this is achievable using the โ€˜Valid Ifโ€™ field but I just canโ€™t get it to work.

Any help with this would be much appreciated. Thanks!

Solved Solved
0 11 459
1 ACCEPTED SOLUTION

I think the following simple expression can work for โ€˜Valid Ifโ€™-

IF((FIND(โ€œNoneโ€,[_THIS]))>1,FALSE,TRUE)

Actually it is working so far.

View solution in original post

11 REPLIES 11

For solving your troubles, give us your data structure and โ€œvalid ifโ€ expr you use

U have to use the IFS() and [_THIS] to create the conditions for the enum values
eg:
IFS(
[_this] = [colunm1], ISNOTBLANK([colunmX]),
[_this] = [colunm2], ISNOTBLANK([colunmy]),
[_this] = [colunm3], ISNOTBLANK([colunmw])
)

Steve
Platinum 4
Platinum 4

Try this:

IF(
  NOT(IN("None", [_THIS])),
  LIST(
    "Connections with a colleague",
    "Buddy with a colleague",
    "None"
  ),
  LIST("None")
)

Thanks Steve. I tried this however Iโ€™m getting the following error

โ€˜Parameter 2 of function IN is of the wrong typeโ€™

Itโ€™s not liking [_THIS] for some reason??

I also gave this expression a go which was accepted but it still allowed me to select โ€˜Noneโ€™ and any of the other options, so itโ€™s still not doing what I want it to.

IF(
(IN([_THIS],List(โ€œNoneโ€))),
LIST(
โ€œNoneโ€
),
LIST(
โ€œConnections with a colleagueโ€,
โ€œBuddy with a colleagueโ€,
โ€œConnections and Buddy with a colleagueโ€,
โ€œNoneโ€)
)

As a workaround Iโ€™ve changed the field type to Enum rather than Enumlist and have added the additional option of โ€œConnections and Buddy with a colleagueโ€. This way the user only needs to select one option so no need for a Vaild If.

It still would be great to know if this if possible and how to achieve it. Thanks for all input though.

Try

IF(
  NOT(
    IN(
      "None", 
      SPLIT([_THIS], " , ")
    )
  ),
  LIST(
    "Connections with a colleague",
    "Buddy with a colleague",
    "None"
  ),
  LIST("None")
)

Thanks @SkrOYC it seems to accept this expression in the Valid If field, however it still isnโ€™t working as I wanted. Itโ€™s allowing me to make selections of โ€œNoneโ€ with any of the other options. Also the Invalid Value Error message doesnโ€™t display if I select โ€œNoneโ€ along with another option?!

Some interesting behaviour though. If I select only โ€œNoneโ€ and move on to the next question then my response of โ€œNoneโ€ is now shown as a single button. If I choose any of the other answers then they are displayed as a comma separated list.

I think the following simple expression can work for โ€˜Valid Ifโ€™-

IF((FIND(โ€œNoneโ€,[_THIS]))>1,FALSE,TRUE)

Actually it is working so far.

Thank you @shahappsheet! This seems to work for me as well

A really simple and elegant solution to the problem.

Actually, I donโ€™t use Valid_If at all for lists. I prefer Suggested Values

I know very little about the Suggested Values. I have seen only that it give a list like dropdowon. Thanks Oscar to open my eyes towards this. Now I will explore it. Actually, I am very very new in AppSheet. Thanks again.

Top Labels in this Space