# Limit Databin value to Booleans only?

Posted 5 years ago
4556 Views
|
|
1 Total Likes
|
 What would be the correct way to limit a Data Drop field to Boolean values only? The following does not work but replies with a message "Restricted was called with the wrong arguments": CreateDatabin["Interpretation" -> { "foobar" -> Restricted["Boolean"]}] The instructions to Restricted indeed do not list a Boolean type. So I'm wondering if I should make the field into a "yes|no" string, or 0 or 1, or something else? Specifically I'd love it if the Web Form to my Databin could just have a checkbox for this field! Is that even possible? I'd also like to create statistics on how often the value was true during a given period of time. The Web Form wouldn't be my only UI though, I'd also use the Web API.
 Oh, I figured it out! I was trying to do it in a too complicated fashion. The "Restricted" function was actually needed for my other fields, but with Boolean it's this simple, and it even creates that nice little checkbox into the Web Form: CreateDatabin["Interpretation" -> { "foobar" -> "Boolean"}]["WebForm"] Now I'm only wondering if there's a way to set it to true by default... Or to set a default value for any other fields for that matter.