Question about Enum on Appsheet

Hi guys!
I am trying to solve this problem:
I need to use the Enum option in the AppSheet that shows 4 values ​​(for example: A, B, C, D), but selecting one of these buttons equals a number (for example: A = 5, B = 6 , C = 8, D = 10)
How can I do this? Should I use AppFormula?

Solved Solved
0 4 141
1 ACCEPTED SOLUTION

@Rodrigo_Albin you need to add a new physical column to your data storage, a google sheet I presume, then after it is added you must use the “Regenerate Structure” button located on the column section of the mentioned table, and after that is done place the expression I showed you on the App Formula field for the column you just added.

The logic there is that you use your Enum column to store the letter, and then use another column for figuring out which number belongs to that letter, and storing it, this can’t be done on a single column.

That’s why the expression doesn’t work when you place it in your Enum column’s app formula field

View solution in original post

4 REPLIES 4

Hello @Rodrigo_Albin, welcome to our community !

Yes ! you could use an expression like this one:

SWITCH([enumColumn],
"A",5,
"B",6,
"C",8,
"D",10,
0)

There are other ways to solve this for cases where you have lots of options, dynamic options, etc etc, but for getting started this will solve your query.

3X_7_a_7a2ee4776fba4faf557bbcd211ed78d47b6812e8.png
Thank you @Rafael_ANEIC-PY !!!
I’m not getting it to work this way, adding the options to Enum and then using AppFormula

@Rodrigo_Albin you need to add a new physical column to your data storage, a google sheet I presume, then after it is added you must use the “Regenerate Structure” button located on the column section of the mentioned table, and after that is done place the expression I showed you on the App Formula field for the column you just added.

The logic there is that you use your Enum column to store the letter, and then use another column for figuring out which number belongs to that letter, and storing it, this can’t be done on a single column.

That’s why the expression doesn’t work when you place it in your Enum column’s app formula field

Thank you very much for your answer! @Rafael_ANEIC-PY

Top Labels in this Space