1
0
-1

Hi, 

we use Sql-Server as database, which use bit-type for boolean. We would like to use a tri-state Check-box. Unfortunately we have started to use $STORE_BOOLEANS_AS_FALSE in ASN-file, which stores null as 0 (false) for boolean-fields.
My tri-state Checkbox works as I remove $STORE_BOOLEANS_AS_FALSE, ie. 
Checkbox On - 1 in database
Checkbox Off - 0 in database
Checkbox undetermined - null in database. (Actually bit can be null)

However using $STORE_BOOLEANS_AS_FALSE
Checkbox On - 1 in database
Checkbox Off - 0 in database
Checkbox undetermined - 0 in database. 

I dare not remove $STORE_BOOLEANS_AS_FALSE from ASN-file.
Is there a way to use a tri-state Checkbox, having $STORE_BOOLEANS_AS_FALSE in ASN-file?
  
Wanting to distinguish between leaving field empty and choosing No (false), do I have another choice than using a Radio-button?

Regards RogerW.


    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi Roger,

      you can also use a DropDownList to rapresent a tri-state condition.

      To safely remove $STORE_BOOLEANS_AS_FALSE from your ASN file, you should add to ALL your those entities using boolean field(s), in the WRITE trigger just before the write instruction, one line of code like:
      if (myBooleanField = "") myBooleanField = 0
      That's not a trivial task!

      Regards,
      Gianni

      1. Roger Wallin

        Hi Gianni,

        a DropDownList is perhaps a clearer way, as tri-state Checkboxes sometimes are a bit confusing for the user. 
        However the same problem there, ie. I can't save Boolean-type as null due to $STORE_BOOLEANS_AS_FALSE. But in this case, I can change it to an integer/numeric.

        Regards RogerW.

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Hmmm, I will solve this by altering the boolean field to integer. Then I can use tri-state Checkbox.

      Regards RogerW.

        CommentAdd your comment...