0

Colorcoding an appointment in calendar

Hi there,

I am trying via "show as" in the appointment field to colorcode the appointment with no success. I have in the employments table created a choice field where the color show which kind of worker it is. I have it to work in a formula field, but when truing to do it in the appointment field in "show as" I fail - any idea of how to do it ?

 

the formula field looks like this :

let Xcol := 'Who should do the job'.Colorcode;
Xcol

and the clot turns to the color of the worker.

 

The appointment "Show As" looks like this :

let Xapp := 'Who should do the job'.Name + " " + text('Appointment Time');
if 'Who should do the job'.Colorcode = 1 then
    let Xcol := "green";
    void
else
    if 'Who should do the job'.Colorcode = 2 then
        let Xcol := "blue";
        void
    else
        let Xcol := "red";
        void
    end
end;
styled(Xapp, "Xcol", "")

but even what ever it remains blue. And preferably I would like the switch function as it will later be 6 colors.

Really appreciate some help here.

Thanks

Leo

2 replies

null
    • Fred
    • 3 mths ago
    • Reported - view

    this works for me:

    switch mC do
    case 1:
        styled(text('Rich text'), "green")
    case 2:
        styled(text('Rich text'), "blue")
    end

    mC is a simple choice field.

    Rich text is an old (pre 3.13) rich text field. I've put in any field here and it works fine. Just have to make sure you put text() around it if it is not a text field.

    Here is the result:

    The two entries for Feb 5th and 6th show a green and blue calendar event. The bottom one is an appointment field.

    You should look into ' great work with javascript to see if his calendar is more suited for your needs.

      • Leo_Woer
      • 3 mths ago
      • Reported - view

       Thank You - off course it works, I have also in the meantime found out what the problem was. I thought I could do the formula in the appointment filed - that doesn't work, but when doing the formula in a formula field and then in the "show as" in the appointment filed refer to the formula field it works perfectly. So now my coding looks like this :

      Formula Field :

      let displayText := "";
      let displayColor := "";
      let displayBackground := text('Who should do the job'.Colorcode);
      if displayBackground = "blue" or displayBackground = "green" then
          displayText := "white";
          displayColor := "white"
      else
          displayText := "black";
          displayColor := "black"
      end;
      let displayIcon := "";
      displayText := 'Who should do the job'.Name;
      styled(displayText, displayBackground, displayColor, displayIcon)

       

      "Show As" in Appointment field :

      Formula Field

       

      Thanks for your contribution

      Leo

Content aside

  • Status Answered
  • 3 mths agoLast active
  • 2Replies
  • 37Views
  • 2 Following