Help with color coding report

  • 0
  • 1
  • Question
  • Updated 8 months ago
  • Answered
Code:
Case([Contact Type], "No Longer with Firm", "#82BE41",
"Terminated Client", "#FFA07A",
"No Longer on the Engagement", "#E1EED9",
"Not a Current Client", "#42BCE8", "")


Error received:
Formula error -- Bad or missing arguments in function call

The types of the arguments or the number of arguments supplied do not meet the requirements of the function Case.

The function is defined to be Case ( x, val1,result1, ..., else-result).

You may need to do one of the following to fix the problem:
  • Choose the right number and type of arguments.
  • Use a type conversion function to convert the arguments you are using to the correct type.
  • Choose a different function
Photo of Mark Comish

Mark Comish

  • 620 Points 500 badge 2x thumb

Posted 8 months ago

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

QuickBaseCoach App Dev./Training, Champion

  • 51,306 Points 50k badge 2x thumb
Can you tell us what field type is [Contact Type]

Maybe it is a multi-select field?
Photo of Mark Comish

Mark Comish

  • 620 Points 500 badge 2x thumb
It gave me this error...

Formula error -- Bad or missing arguments in function call

The types of the arguments or the number of arguments supplied do not meet the requirements of the function Contains.

The function is defined to be Contains (Text u, Text v).

You may need to do one of the following to fix the problem:
  • Choose the right number and type of arguments.
  • Use a type conversion function to convert the arguments you are using to the correct type.
  • Choose a different function.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,306 Points 50k badge 2x thumb
Hmmm, and you exactly pasted in the formula above?  Can I see your exact formula? 
Photo of Mark Comish

Mark Comish

  • 620 Points 500 badge 2x thumb
var text ContactTypeInTextFormat = ToText([Contact Type]);

If(
Contains($ContactTypeInTextFormat, "No Longer with Firm"), "#82BE41",
Contains($ContactTypeInTextFormat,"Terminated Client"), "#FFA07A",
Contains($ContactTypeInTextFormat,"No Longer on the Engagement"), "#E1EED9",
Contains($ContactTypeInTextFormat,"Not a Current Client", "#42BCE8"))
Photo of Mark Comish

Mark Comish

  • 620 Points 500 badge 2x thumb
I got it!  Thanks just needed to move a )
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,306 Points 50k badge 2x thumb
OK, I see my error now n the last line.

Contains($ContactTypeInTextFormat,"Not a Current Client"), "#42BCE8")
Photo of Lisa

Lisa

  • 210 Points 100 badge 2x thumb
The Case statement doesn't need the final clause - this is all you need to do:
Case([Contact Type], "No Longer with Firm", "#82BE41",
"Terminated Client", "#FFA07A",
"No Longer on the Engagement", "#E1EED9",
"Not a Current Client", "#42BCE8")
Photo of Mark Comish

Mark Comish

  • 620 Points 500 badge 2x thumb
It gave this error, probably because Contact Type is a multi select text...

Formula error -- Bad or missing arguments in function call

The types of the arguments or the number of arguments supplied do not meet the requirements of the function Case.

The function is defined to be Case ( x, val1,result1, ..., else-result).

You may need to do one of the following to fix the problem:
  • Choose the right number and type of arguments.
  • Use a type conversion function to convert the arguments you are using to the correct type.
  • Choose a different function.