 # Math Expression Enum Value

Hi guys,

Thank again for all the help.

I am trying to achieve something that I would like to see if you cal help me with.

I have a Column = Sub Total
the following column refers to discount which I have prefixed values as Enum. (2%, 4%, 6%, 8%, 10%)
The following column is a Total which I want to be calculated (Sub Total)-(Discount) automatically once the user selects one of the previous mentioned enum value.
Appsheet is not calculating this automatically, my guess is because the form is not saved and synced
is there any way to obtain this calculation automatically before the form has been saved?

best

Luis

Hi Luis,

The issue appears to be inconsistent data types. To perform mathematical operations, the values need to both be numbers.

By including the “%” symbol in your Enum options, AppSheet is interpreting the entry as text.

AppSheet will interpret your Enum as a number if the Enum options are made up entirely of numbers and you set the “Base Type” to “Number.” The Base Type is one of the options you have when you click the edit button next to a column of type Enum.

1 Like

ok I changed the base type and even have AppSheet accept the expression with the “%” Symbol

now I need a Math Lesson from you professor jajajaja has It seems I know little about it… if I leave the number without the % number AppSheet can’t calculate the discount percentage, if I leave it in AppSheet accepts the expression but does not calculate anything.

how do I fix it?

I tested another way to do this. For the [Discount] column, you can

• Set the data type to Enum
• Enter your discounts as decimals
• Set the base type to “Percent”

Then you can multiply the [Total] column by the [Discount] column to get the [Discounted Total]. For example, in the [Discounted Total] column, you could set the following formula:
[Total] * [Discount]

If you set the data type to “Price” for [Total] and [Discounted Total], then it will add a currency symbol for you.

4 Likes

Smart!!!

thank mate!!!

1 Like