Case function syntax error

  • 0
  • 1
  • Question
  • Updated 2 years ago
  • Answered
I am trying to implement the solution described in this article http://quickbase.intuit.com/quickbase-blog/colorful-icons-make-quickbase-faster but I am getting a syntax error on my case function. Help!

I've attached a picture of my code, because pasting it here wasn't working (it was converting the HTML).

Photo of Laura

Laura

  • 0 Points

Posted 3 years ago

  • 0
  • 1
if you post your code and put spaces in the h t t p s then it will not render the code as html and I can correct it.  You have a bunch of extra " quotes.
Photo of Laura

Laura

  • 0 Points
Ah! Thanks.

Case([RAG Status],"Red","<img src="h t t ps://images.quickbase.com/si/24/221-point_red.png">",
"Amber","<img src="h t t ps://images.quickbase.com/si/24/223-point_yellow.png">",
"Green","<img src="h t t ps://images.quickbase.com/si/24/222-point_green.png">")
Case([RAG Status],

"Red","<img src=h t t ps://images.quickbase.com/si/24/221-point_red.png>",
"Amber","<img src=h t t ps://images.quickbase.com/si/24/223-point_yellow.png>",
"Green","<img src=h t t ps://images.quickbase.com/si/24/222-point_green.png>")
Photo of Jan-Willem

Jan-Willem

  • 560 Points 500 badge 2x thumb
A similair situation though a bit different...

I would like to use the progress bar icons
https://login.quickbase.com/db/bcgnn27bx?act=QuickSearch&srchtxt=progress&Find=
on a 'Formula%" field based on a field called ie %Milestone

something like (in my human logic & language)
if ( [ %milstone]=0, "<img src=https://login.quickbase.com/up/bcgnn27bx/g/rzd/eh/va/progress0.png>",
if ( [ %milstone]> 0 and [ %milstone] <25 , "<img src=https://login.quickbase.com/up/bcgnn27bx/g/rze/eh/va/progress25.png>",
if ( [ %milstone]> 24 and [ %milstone] <50 , "<img src=https://login.quickbase.com/up/bcgnn27bx/g/rzf/eh/va/progress50.png>",
if ( [ %milstone]> 49 and [ %milstone] <75 , "<img src=https://login.quickbase.com/up/bcgnn27bx/g/rzg/eh/va/progress75.png>",
if ( [ %milstone]=100, "<img src=https://login.quickbase.com/up/bcgnn27bx/g/rzh/eh/va/progress100.png>",
)))))

This is however not the proper code for QB i'm afraid.
I tried different variations but can't find the proper context yet

syntax check replies "Please check the syntax of your formula. Look for mismatched parentheses, missing quotes, or extra brackets." and points to the first '('

Any suggestions?
(Edited)
Photo of Jan-Willem

Jan-Willem

  • 560 Points 500 badge 2x thumb
I did find this thread...
https://community.quickbase.com/quickbase/topics/status-icon-formula-help though when that is indeed the only sollution I would need to bring some more code into the %milstone formule so that can only produce 0,25,50,75 or 100 as result.

This thread https://community.quickbase.com/quickbase/topics/what-could-be-wrong-with-this-case-formula indicated it should work somehow witth the IF -function also
Try this.  unlike Excel you do not need to nest your IFs, so most IF statements only need one IF.



if (
[ %milstone]=0, "<img src=https://login.quickbase.com/up/bcgnn27bx/g/rzd/eh/va/progress0.png>",

[ %milstone]> 0 and [ %milstone] <25 , "<img src=https://login.quickbase.com/up/bcgnn27bx/g/rze/eh/va/progress25.png>",

[ %milstone]> 24 and [ %milstone] <50 , "<img src=https://login.quickbase.com/up/bcgnn27bx/g/rzf/eh/va/progress50.png>",

[ %milstone]> 49 and [ %milstone] <75 , "<img src=https://login.quickbase.com/up/bcgnn27bx/g/rzg/eh/va/progress75.png>",
[ %milstone]=100, "<img src=https://login.quickbase.com/up/bcgnn27bx/g/rzh/eh/va/progress100.png>")


Also note that if your [% milestone field is a % format, then it's value will range from 0.00 to 1.00

so your 2nd  line will ned to read 

[ %milstone]> 0 and [ %milstone] <0.25 ,  ......

and you will need to adjust the rest of the lines.
(Edited)
Photo of Jan-Willem

Jan-Willem

  • 560 Points 500 badge 2x thumb
Thanks  i will try to make myself comfortable with it for a next occasion.

OFF-TOPIC
For those who strggle with similair issue and land on this thread:
Looking at function and presentation I think i will follow a different path as explainded here
https://community.quickbase.com/quickbase/topics/-completed-button.