Forum Discussion

MarkComish's avatar
MarkComish
Qrew Assistant Captain
7 years ago

Help with color coding report

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
  • Can you tell us what field type is [Contact Type]

    Maybe it is a multi-select field?
    • MarkComish's avatar
      MarkComish
      Qrew Assistant Captain
      Yes it is a multi select text

      Mark
    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      Try this
      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"))
    • QuickBaseCoachD's avatar
      QuickBaseCoachD
      Qrew Captain
      Note that since more than 1 value can selected, the first one which is true will "win".
  • 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")
    • MarkComish's avatar
      MarkComish
      Qrew Assistant Captain
      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.