Formula Help

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • Answered
I'm attempting to create a series of colorized progress trackers, based on a number of requirements.  To do so, I'm trying to colorize a field based on a number of checkboxes.  

Example:

I have different types of contacts that I need my sales folks to ensure we have in place prior to moving a deal forward.  What I would like is for the status bar on the main page to change color based on having none of the boxes checked (Red), any one of the boxes checked (Orange), and two boxes checked (Yellow) and all boxes checked (Green).

Thoughts?

Mike
Photo of Mike

Mike

  • 574 Points 500 badge 2x thumb
  • confused

Posted 1 year ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,894 Points 50k badge 2x thumb
There are 502 icons here available for public use in 5 convenient sizes.

https://login.quickbase.com/db/9kaw8phg?a=ShowPage&pageid=134

https://login.quickbase.com/db/bcgnn27bx?a=q&qid=1000039

var number NumCompleted =
Count( [checkbox 1], [checkbox 2],[checkbox 3]);

Case($Count,
0, "<img src=https://images.quickbase.com/si/32/221-point_red.png>",
1, "<img src=https://images.quickbase.com/si/32/223-point_yellow.png>",
2, "<img src=https://images.quickbase.com/si/16/224-point_blue.png>",
3, "<img src=https://images.quickbase.com/si/32/222-point_green.png>")
Photo of Mike

Mike

  • 574 Points 500 badge 2x thumb
Ok, So I probably should've started with, I kinda suck at formulas.  I've put what you showed above into my field, changed the "[checkbox 1] to the actual name of the field, and I'm getting the following error.  
Sorry to be a hassle.

Mike

*NOTE*
I'm going to need to replicate this across a couple of different tables that are not only related to contacts.

--------------------------------------------------------------------------------------------------------------------------------------

var number NumCompleted = Count([Buyer], [Decision Maker],[Influencer]);Case($Count,0, "<img src=https://images.quickbase.com/si/32/221-point_red.png>";, 1, "<img src=https://images.quickbase.com/si/32/223-point_yellow.png>";, 2, "<img src=https://images.quickbase.com/si/16/224-point_blue.png>";, 3, "<img src=https://images.quickbase.com/si/32/222-point_green.png>")

Error message:

Formula Error--Undeclared Identifier
The variable Count is not declared
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,894 Points 50k badge 2x thumb
No problem, there was a clear error in my formula
Change that first part to this

var number Count NumCompleted = 
Count( [checkbox 1], [checkbox 2],[checkbox 3]);
Photo of Mike

Mike

  • 574 Points 500 badge 2x thumb
I apologize for being a pain (and for not understanding formulas better at this point), but I'm still getting an error message.  

Immediately below is the error message.  Below that, is exactly what I have placed in the formula box.

Thanks again for all the help.

Mike

Error Message
_______________________________

A variable declaration must have an assignment operator.


var number Count   NumCompleted = Count([Buyer], [Decision Maker],[Influencer]);Case($Count,0, "<img src=https://images.quickbase.com/si/32/221-point_red.png>";, 1, "<img src=https://images.quickbase.com/si/32/223-point_yellow.png>";, 2, "<img src=https://images.quickbase.com/si/16/224-point_blue.png>";, 3, "<img src=https://images.quickbase.com/si/32/222-point_green.png>")

In my Formula Box
________________________________

var number Count NumCompleted = Count([Buyer], [Decision Maker],[Influencer]);Case($Count,0, "<img src=https://images.quickbase.com/si/32/221-point_red.png>";, 1, "<img src=https://images.quickbase.com/si/32/223-point_yellow.png>";, 2, "<img src=https://images.quickbase.com/si/16/224-point_blue.png>";, 3, "<img src=https://images.quickbase.com/si/32/222-point_green.png>")
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,894 Points 50k badge 2x thumb
Try this

var number Count NumCompleted = Count([Buyer], [Decision Maker],[Influencer]);

Case($Count,0,
"<img src=https://images.quickbase.com/si/32/221-point_red.png>",
1, "<img src=https://images.quickbase.com/si/32/223-point_yellow.png>",
 2, "<img src=https://images.quickbase.com/si/16/224-point_blue.png>",
3, "<img src=https://images.quickbase.com/si/32/222-point_green.png>")
Photo of Mike

Mike

  • 574 Points 500 badge 2x thumb
Same error message.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,894 Points 50k badge 2x thumb
Sorry my mistake
Chance the first line to this

var number Count  = Count([Buyer], [Decision Maker],[Influencer]);
Photo of Mike

Mike

  • 574 Points 500 badge 2x thumb
Perfect.  Now we're getting somewhere.  However, the record only displays the URL as opposed to the icon.
Thoughts?

Mike
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,894 Points 50k badge 2x thumb
The field type is probably Formula text.
Can you carefully change it to formula Rich text.  make sure you choose formula Rich text and not Rich Text.
Photo of Mike

Mike

  • 574 Points 500 badge 2x thumb
And now I feel like an idiot.  Lol.  
Thanks for all the help on this.  I owe you a drink at Empower.

Mike
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 69,894 Points 50k badge 2x thumb
:) I will be there ....  That field type is a new thing. it used to be a checkbox to enable html on a regular  formula field, but that changed in the December release to a separate field type.