Skip to main content
Question

What does the true value mean at the beginning of some case statements in QuickBase?

  • December 20, 2017
  • 0 replies
  • 165 views

JimHarrison
Forum|alt.badge.img+18
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.

  • Registered
  • December 20, 2017

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?



JimHarrison
Forum|alt.badge.img+18
  • Author
  • Registered
  • December 20, 2017
But we are not using a field called , otherwise your response would make sense and is covered in the reference. 

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.

  • Registered
  • December 20, 2017
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().

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.

JimHarrison
Forum|alt.badge.img+18
  • Author
  • Registered
  • December 20, 2017
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

)