TonyaJacques
Qrew Member
6 months ago

# Formula error

I am having trouble creating a field that can be added to the series section of a pie chart. The pie chart needs to show how a color associated with each condition to be able to split the pie chart in the sections. My formula keeps saying expecting boolean and I am not sure why. I have included a 1 at the end of each condition and a 0 at the end. Can some one help with getting the formula to work please?

Here is the code:

if(
[Days Open] <= 30, [(HIPO) / (HVL)] = "HIPO", "#2ca01c", 1, // show green if the event is HIPO and days open is 30 days or less
[Days Open] <= 31, [ (HIPO) / (HVL)] = "HIPO", "#ad0707", 1, // show dark red if the event is HIPO and days open is 31 days or more
[Days Open] >= 60, [(HIPO) / (HVL)] = "HVL", "#2ca01c", 1, // show green if the event is HVL and days open is 60 days or less
[Days Open] <= 61, [(HIPO) / HVL (HVL)] = "HVL", "#ff0808", 1, // show red if the event is HVL and has been open 61 doays or more
// conditions above apply to closed events
[Days Open] <= 0,  [Days Open] >= 21, [(HIPO) /  (HVL)] = "HIPO", "#0089cd", 1, // show blue if the event is HIPO and between 0-21 days
[Days Open] <= 22,  [Days Open] >= 30, [(HIPO) /  (HVL)] = "HIPO", "#fff700", 1, // show yellow if the event is HIPO and between 22-30 days
[Days Open] <= 31, [(HIPO) / (HVL)] = "HIPO", "#ff0808", 1, // show red if the event is HIPO and has been open for 31 days or more
[Days Open] <= 0,  [Days Open] >= 52, [(HIPO) /  (HVL)] = "HVL", "#0089cd", 1, // show blue if the event is HIPO and between 0-52 days
[Days Open] <= 0,  [Days Open] >= 21, [ (HIPO) / (HVL)] = "HIPO", "#fff700", 1, // show yellow if the event is HIPO and between 53-60 days
[Days Open] <= 0,  [Days Open] >= 21, [(HIPO) / (HVL)] = "HIPO", "#2ca01c", 1, // show green if the event is HIPO and has been open for 61 days or more
// conditions above apply to open events
,0)

------------------------------
Tonya Jacques
------------------------------

### 4 Replies

• I'm a bit confused as to what you are trying to do.  Are you trying to set a color for each slice of the pie by formula?  If so, Pie charts do not support that.

------------------------------
Mark Shnier (Your Quickbase Coach)
mark.shnier@gmail.com
------------------------------
• Hey Tonya, like Mark mentioned we can't always control the colors that will be used, but you can control the results of your formula to force otherwise unrelated values into common groups. The groups may then be included as the Series in Pie Charts.

I don't think your formula logic as it stands will yield the expected result as there are multiple conditions that are unclear. For example, if we take the just the first condition, what are you hoping to evaluate and what should be the outcome if true? To me it seems like you blended the logic of a couple different scenarios and they may be better are two different formulas, for example one formula outputting the "age" and other "outputting" the type?

Then, you would take the results of that formula and set it as your Series. Quickbase will then auto-color each Series group (pie slice). If you go back into the report settings, you can  manually override the colors by clicking the little color swatches in the Legend.

Oh, regarding your error … it's because there is a mismatch between what you have set as your Field Type (Boolean) and the results of your formula which is presumably outputting text (e.g. "HIPO" or "#2ca01c").

Hopefully that helps!

------------------------------
Brian Seymour
------------------------------

• Thank you to everyone! I was able to fix the error. I did not need the 1 or the 0 at the end and I also had to separate each field and put the result next to each condition.

------------------------------
Tonya Jacques
------------------------------