Forum Academy Marketplace Showcase Pricing Features

Dynamic colour for calendar based on another field (in Type)

Hello,

I am trying to have the Eventcolour change according to another Field (of Type in my Database).

Is there by now a way to do that?

so does this work:
(tag is a field, eventcolour is a field)

WHEN tag=retreat -> Eventcolour=#F33333

I read it wasn´t previously possible, but is it now? @emmanuel @romanmg @mishav

or is this maybe possible in conditional? (if so, how? I haven´t been able to to do it)

Yes, a few different ways to do this. Easiest is the following condition, which is exactly what you describe: when tag = retreat > event color = hex code

That just changes the default event color to whatever you want. But, you can also make the event color field dynamic so that it always points to a field with a hex code. Check “use dynamic color for each event” and then you select the field (in your case, “Eventcolour”. On top of that, you can use a condition to change the field (when dynamic color is checked), so that if you have 2 different fields with different colors, you can change them.

EDIT: I think option 2 is actually the one that will work for you now that I’m re-reading your question. So, turn on dynamic color so that it will pull from whatever is in the field for any event. Retreat, for example, would have a different value than some other tag.

1 Like

Hey,

Thank you so much.

I do however still have one difficulty:
I can only select `selected event colour´ to change , which means the colour only changes once I have clicked on the event.

Am I doing something wrong? ( use dynamic is enabled, and even colour field is colour:))

Right, this is why I think the other method will work better for what you need. The hex code will need to be saved to the actual thing in the database. So anything that gets tagged as “ABC” also means color field = color1. When something gets tagged as “XYZ”, color field = color2. Instead of using conditions on the calendar element, everything is saved to the thing, and the “dynamic color” option is selected in the calendar element (choose color field) and it will always read whatever is in that field as opposed to "hard coding " it. Does that make sense?

Hm, it does apart from that I don´t understand how to connect colour and “XYZ”

at the moment i´m putting in the hex codes manually.

where and how do I tell the data exactly what you said:
anything that gets tagged as “ABC” also means color field = color1. When something gets tagged as “XYZ”, color field = color2

Ok, great, so now all you have to do is in the calendar element’s property editor, check “use a dynamic for each event” and then select that field that you are manually saving for each thing. You don’t need to bother with adding a condition. Now, the calendar will automatically change the color based on what is saved in that field for each event.

You should come up with a workflow that saves the appropriate hex whenever a new thing is created/tagged so that color and tagging happen at the same time and you don’t have to manually enter.

3 Likes

aha! yes that last bit about the workflow! I shall do that and show you my glorious results! Thanks for your help, brilliant!!

2 Likes

Hm,

I found a way that I thought would be smart. But it turns out its not as it doesn´t work:)

I made a workflow an told one of the fields to replace the word “circus” with the hex code of the colour. And I told the calendar it was to use “dynamic colour for each event” , respective to the ´colour´ field in the database.

Here is a screenshot.

where am i going wrong?

Nice idea!

What do you mean by “it doesn’t work”? What value did you see in the colour field?

To make that approach work for all disciplines, you’d need an additional :find & replace for every possible discipline, which is okay for a small number of values. And to handle the is empty condition, if the app considers discipline to be optional.

A more robust way to implement your idea is to have a data type “Discipline”, with a field for colour and another for name. The dropdown can choose a Discipline, and you can either copy the Discipline values of name and colour to the event, or the event can refer to a Discipline thing: Event’s Discipline.

thanks for your response:)

So by it doesn´t work, i mean, it does not show up in the calendar as the colour it is supposed to.

I do have a data field Discipline and one Colour, but I am still having trouble finding a way to connect them without having to do it manually.

Where are the values for discipline stored, for the user to pick from?

I’m ignoring the “tag” and “Type” and assuming you want to use the Discipline value to determine the event colour.

Proposed data setup:

Data Type: Discipline
Fields:

  • name (text) values: one of Circus, Dance, Acroyoga
  • colour (text) values: one of #F33333, etc.

Data Type: event
Fields:

  • discipline (Discipline) values: a link to one of the Discipline things or rows

Then the Discipline dropdown can choose a Discipline thing, the caption showing “this option’s name”, and the chosen discipline is stored in an event row.

The calendar can use event’s discipline’s colour.

Happy fat Santa day and Boxers day!