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.
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.
 1,836 Points
Posted 1 year ago
 4,430 Points
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?
(Edited)
 1,836 Points
But we are not using a field called [true], otherwise your response would make sense and is covered in the reference.
 4,430 Points
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".
(Edited)
 1,836 Points
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)
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)
QuickBaseCoach App Dev./Training, Champion
 63,004 Points
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.
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.
 4,430 Points
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().
QuickBaseCoach App Dev./Training, Champion
 63,004 Points
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.
 1,836 Points
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
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 aloneCase(true,
[cxbx1]=[cxbx2], //this is true
true,
[cxbx3]=true,
true,
false
)
Related Categories

Formulas & functions
 2895 Conversations
 71 Followers