Values for Enum

Hello!

Is it posible to add values for specific Enum values?
Eg: Enum values= Yes and No, value for Yes=1, value for No=0 and the initial value should be 0

@SABIO_Soporte
Not directly but you can provide that value calculation via expressions

I did, but when I edit the row and change the enum to another value, the value in the spreadsheet is no changing to the new value. Neither in virtual as in real column

I try with both IF and IFS expressions

@SABIO_Soporte
You should consider using the Reset_on_Edit property, so that every time the expression evaluates to TRUE, it will reset its value to the initial value of the column.

[ColumnName]<>LOOKUP([_THISROW].[Key],"Tablename","Key","ColumnName")

If I use this, what happends when they open the row to edit?
It will erase all data and add a new one without selecting any enum value?

Create a separate table with two columns:

Key Label
0 No
1 Yes

Then make the column that is currently Enum instead a Ref to the above table.

3 Likes

Thanks Steve.
What if I had several values? I think I need to ad some expression in Valid if?

Can you provide more details?

I had 5 surveys where each survey have several questions, some more than 50.
Some group of columns had the same value for the answer Y or N, and some other columns have individual values for each answer Y or N.
So for the same answer Y or N I had more than 30 different values, depending on the survey questions.
What I did is that I duplicated the same amount of columns in each table so if the user answer Y or N I get the value for that answer in other column.

Eg: [Question_1]=Y in column [Value_Question_1]=1
In [Value_Question_1] I have this expression: IF([Question_1]=“Y”,1,0 )

Then the App sums the values of all the answers from the survey to get an average score of each survey.
The thing is, that after the form is saved, if I re open it and edit the values changing any Y or N, the results of the Sum is incorrect beacause the only value that the App changes in the spreadsheet after save the edit are the values from the Enum columns [Question_1]… and is not updating the value of the If condition in the duplicated column [Value_Question_1].

I try this as in actual columns and in virtual columns and this issue happens in both examples.

Clearly, my suggestion above won’t work for you.

There are several ways to address this (choose one):

  1. Make the column with the computed value a virtual column. This will have a performance impact as your table grows, and the value will not be written to your spreadsheet. I don’t recommend this.

  2. Set Reset on edit to ON for the value column. This will prompt the Initial value expression for the column to be reevaluated every time the row is updated by a form.

  3. Instead of using Initial value, use App formula. The App formula expression will be reevaluated each time the row is modified.

Set Reset on edit to ON for the value column. This will prompt the Initial value expression for the column to be reevaluated every time the row is updated by a form. This will change only the values that have change only in the columns that are beeing edited?

Instead of using Initial value , use App formula . The App formula expression will be reevaluated each time the row is modified. Ok, I think I use App formula, i will check.

I did steps 2 and 3 but still the same issue, the value in the spreadsheet column is not changing for the new value depending on the enum selection.
BUT, another strange thing is happening, In the column that SUM´s, the result of the SUM is changing.

Is the new sum correct?

Yes, the sum is correct.
Verry Strange

@Steve any other idea on how can I solve this?

You should probably engage support@appsheet.com.

Ok thanks!