Hello community: I will appreciate your help ...

(SmartD) #1

Hello community: I will appreciate your help with the following question: In the case of inspections, it is very common to use the questions with the answer options “YES” and “NO”. Question: Is there a way for the application to write “1” or “0” in the database when the user selects “YES” or “NO” in the application? This is to facilitate the calculation of metrics in subsequent reports, to keep the experience for the user more familiar with the options “YES” and “NO”. Thanks in advance!

#2

@Aleksi_Alkio - I am still learning and like to try out new approaches, but am missing something in your explanation.

Can you clarify what you mean by “If you call your field as a ref”… ?

I am not setting this up correctly to get it to work.

My steps: 1. Creates a gsheet TABLE

with two columns.

Then “Added” as new table in appsheet, with text and number field. 2. In Columns, changed “number” to key and set “text” as label. 3. Created new View called “convert” and positioned as Ref (but not sure that is what you mean).

*IF I add or edit a record in “convert”, I hoped I could change the Y/N text and see the “number” change.

Can you help me understand better?

Apologies for additional questions, but hoping to learn - and really appreciate you taking the time to help like you do!

Hello community: I will appreciate your help with the following question: In … plus.google.com

(Steven Coile) #3

There is no way to have a Y/N column type record 1 or 0.

#4

but would it be possible to add a virtual column to calculate Yes = 1?

eg: using SWITCH?

(SmartD) #5

@Aleksi_Alkio thanks you!!! I could hide the action. All is perfect.

(SmartD) #6

@Mike_Adler

you can know more about reference between tables (Ref type) in this help article: help.appsheet.com - References Between Tables

References Between Tables help.appsheet.com

#7

Ah… thanks for the clarification. Will give that a shot.

So by reference to another table with Y/N as text plus a number, you can get the 0 or 1 value.

I think I am finally getting it…

:slight_smile:

(Aleksi Alkio) #8

Correct

(Steven Coile) #9

@Mike_Adler not a virtual column, because virtual columns aren’t written to your data store. Instead, you want a normal column with an App formula.

#10

Ah!

I need to get my vocabulary right…

+Soporte SmartD - good news is, +Steve Coile suggesting this can be done with the App Formula…

(SmartD) #11

@Mike_Adler thanks for your answer. +Steve Coilethanks for your answer too, but I was trying a diferente solution because if I use App Formula for my 80 Y / N questions, I would have to add other 80 columns and it is not conveniet. Any way yhank you very much.

(Aleksi Alkio) #12

Create a small table with two columns… text and number field. The number field is a key and text is a label. If you call your field as a ref, it will show you the text like “Yes”, but it will save the number 1.

(SmartD) #13

@Aleksi_Alkio your solution is perfect!!! I did it and it worked very well!!! Thank you very much!

Note: Is it possible to delete the arrows that appear in the detail view next to a referenced field?

(Aleksi Alkio) #14

The ref arrow is an action. You can find it from system actions and then just hide it.

(Aleksi Alkio) #15

Open the column definition of your table (other than this “text/number” table), choose the column type as ref. Open that column’s definition and choose the correct table for the option “ReferencedTableName” and that’s it.