Results 1 to 6 of 6
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Triple State Boolean

    I know it defies the definition of boolean, but is there such thing as a triple state boolean variable? There is a triple state check box, you know. And check boxes were once only boolean in nature.

    I want to test for the existence of a document variable in a function defined as boolean and return either 1) a value indicating the doc var does not exist, 2) that it exists and has a certain value or 3) it exists and does not have a certain value.

    Should I instead define the function as string and return "NO", "TRUE" or "FALSE"?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Triple State Boolean

    You can define the function as Boolean and return +1, 0, and -1. However, you can't use "True" as a test for its state since any value other than 0 is considered true. You could also define it as Integer and return the same things.
    Legare Coleman

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Triple State Boolean

    Legare,

    Thanks for the insight. I'll code up the thing and see if I can make it work.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Triple State Boolean

    You could try someting like <pre>Function TriState() AS Variant
    Select Case Tri
    Case Is = 1
    TriState = CBool(False)
    Case Is = 2
    TriState = CBool(True)
    Case Is = 3
    TriState = "No"
    End Select
    End Function</pre>

    An Logic test on the result of the above returns either True, False or an Error, so if you test for an error, and if not found then test for True or False. It's a bit convoluted but it will either work, or wont work or maybe it will.

    Andrew C

  5. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    New Hampshire, USA
    Posts
    3,386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Triple State Boolean

    Tri-state is usually represented in one of the following ways:

    1. negative, zero, positive
    2. No, Maybe, Yes
    3. Connecticut, New Jersey, New York

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Triple State Boolean

    That's the Howard we all know and love...
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •