Discussions

 View Only
  • 1.  What does the true value mean at the beginning of some case statements in QuickBase?

    Posted 12-19-2017 22:07
    I looked at the Formula reference and through the community and don't see an explanation to this syntax. 

    I can see other language references on Google but want to get specific documentation.

    Can anyone tell me the purpose of the true at the beginning of some case statements.

    Example Case(true, eval1, true, eval2,true,false)

    Is this setting the default value of the field as true? Or is it only evaluating the eval1 statement if the value in the field is true.


  • 2.  RE: What does the true value mean at the beginning of some case statements in QuickBase?

    Posted 12-19-2017 22:12

    Let's take a field called [Verify], it is of type formula text. Below is its code.

    Case(

    [value],1,"OK",2,"OK",3,"Bad",4,"Worse"

    )


    So what we've done in [Verify] is make its text value either "OK", or "Bad" Or "Worse", depending on the value of [value], when [value] is 1 or 2 or 3 or 4.

    If 1 is true, then "OK". IF 2 is true, then "OK", if 3 is true, then "Bad", if 4 is true, then "Worse".

    Does this make sense?




  • 3.  RE: What does the true value mean at the beginning of some case statements in QuickBase?

    Posted 12-19-2017 22:15
    But we are not using a field called [true], otherwise your response would make sense and is covered in the reference. 


  • 4.  RE: What does the true value mean at the beginning of some case statements in QuickBase?

    Posted 12-19-2017 22:18
    So, as we evaluate [Value], we are asking, is [value] equal to 1? If it is equal to 1, then that logically equates to boolean true. Since it is true ( in this explanation ) that [Value] is equal to 1, then the formula text field [Verify] will be equal to "OK".


  • 5.  RE: What does the true value mean at the beginning of some case statements in QuickBase?

    Posted 12-19-2017 22:34
    So the first "true" is referring to the current value of the formula. The field where the case statement formula is stored.

    Given it is a checkbox field then where 2,3,4 are other fields being evaluated.
    Case(true, true,[2],true,[3],true,[4],true,false)


  • 6.  RE: What does the true value mean at the beginning of some case statements in QuickBase?

    Posted 12-19-2017 22:20
    imho it works but is a confusing syntax to use,

    The results is the same as this

    IF(
    eval1=true, true,
    eval2 = true,true)

    but that can be simplied to

    IF(
    eval1, true,
    eval2,true)


    In this case both eval 1 and eval true are boolean checkbox formula fields.


  • 7.  RE: What does the true value mean at the beginning of some case statements in QuickBase?

    Posted 12-19-2017 22:23
    Yeah, but If() is for more complex logical constructs. Case() is great to evaluate one variable of limited possible values. The logic probably executes faster than IF().


  • 8.  RE: What does the true value mean at the beginning of some case statements in QuickBase?

    Posted 12-19-2017 22:31
    Good luck with a stop watch to try to measure any difference.  Evaluating TRUE against two expressions for eval1 and eval2, is the same as calculating the TRUE or not of those two expressions.  either way Quick Base has to calculate if they are each true.


  • 9.  RE: What does the true value mean at the beginning of some case statements in QuickBase?

    Posted 12-19-2017 22:49
    It appears to set the default value for the field. 

    Made a table with some fields and here is the result. 
    always unchecked except if all or cxbx3 checked

    Case(

    [cxbx1]=[cxbx2],

    true,

    [cxbx3]=true,

    true,

    false

    )

    always checked except if cxbx1 or cxbx2 checked alone

    Case(true,

    [cxbx1]=[cxbx2], //this is true

    true,

    [cxbx3]=true,

    true,

    false

    )