Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.

CASE WHEN equivalent in AppSheet operating on a list column

How to categorize a list column?

For example, I have 3 rows in my table, the column type is List and column name is [Purchase Status]:

1. {To Purchase, Purchase Complete}
2. {Purchase Complete, Purchase Complete}
3. {To Purchase, To Purchase}

To further categorize my [Purchase Status], I have tried using:

 

 

SWITCH(
  ANY(UNIQUE(LIST([Purchase Status]))) = "To Purchase", "To Purchase",
  ANY(UNIQUE(LIST([Purchase Status]))) = "Purchase Complete", "Purchase Complete",
  "Partially Purchased"
)

 

 

But got the error: 

Cannot compare List with Text in (ANY(UNIQUE(LIST([Request Item Status]))) = "To Purchase")
 
I am trying to achieve:
If all values in the list is "To Purchase", return status = "To Purchase",
if all values in the list is "Purchase Complete", return status = "Purchase Complete",
else return "Partially Purchased"
Solved Solved
0 9 580
2 ACCEPTED SOLUTIONS

If you want to check an item against a list, use IN() instead of '='.

https://help.appsheet.com/en/?q=In 

Update: hit send too soon

Using IN() you can first check if "Purchase Complete" is in the list, if it is not, then the result will be "To Purchase". Then check if "To Purchase" is in the list, if it is not then the result is "Purchase Complete". Else the answer is "Partially Purchased"

View solution in original post

If understanding of your requirement is correct, maybe you could try something like below

IFS(

AND(COUNT([Purchase Status])=2, NOT (IN("To Purchase",[Purchase Status]))), "Purchase Complete",

AND(COUNT([Purchase Status])=2, NOT (IN( "Purchase Complete",[Purchase Status]))), "To Purchase",

AND(COUNT([Purchase Status])=2, "Partially Purchased"

)

 

 

View solution in original post

9 REPLIES 9
Top Labels in this Space