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

Solved Solved
1 4 1,310
1 ACCEPTED SOLUTION

Derek3
New Member

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.

View solution in original post

4 REPLIES 4

Derek3
New Member

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.

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?

Derek3
New Member

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.

Smart!!!

thank mate!!!

Top Labels in this Space