Okay all you database people out there, I hav...

(Multi Tech Visions) #1

Okay all you database people out there, I have a question for you about the YesNo column type from App sheet…

What am I supposed to use as the column type in a mySQL database?

I’ve looked this up and I’ve tried several different things, but none of them seem to be working.

I’m just wondering what others have used before that works?

(Levent KULAÇOĞLU) #2

Two ways:

BIT datatype (see http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html) wich is a numeric datatype. true and false correspond to 1 an 0 respectively

ENUM datatype (see http://dev.mysql.com/doc/refman/5.0/en/enum.html). Defines a list from which only one value must be chosen:

ENUM(‘TRUE’,‘FALSE’) or ENUM(‘yes’,‘no’)

(Multi Tech Visions) #3

Hmmm… Tried both of the enum options, neither of those worked… Let’s see about that first one

(Reza Raoofi) #4

I have used ENUM before; it goes well, but on the AppSheet side you should set Enum column type with text values being ‘Yes’ and ‘No’.

(Steven Coile) #5

https://stackoverflow.com/questions/1777257/how-do-you-create-a-yes-no-boolean-field-in-sql-server

(Reza Raoofi) #6

Using BIT in MySQL could be tricky; I have seen different MySQL clients having issues properly displaying BIT column’s value, or updating/inserting values in it; sometimes I found they were trying to insert ‘1’ or ‘0’ in the column, and MySQL returned error; AppSheet’s Yes/No column seems to work as expected though, but if AppSheet is not your only client, and you want to be safe for future integrations and to make sure the column will be universally treated the same way, then I recommend using TINYINT; at least it would be clear for all clients to treat it like a simple integer.