Saturday, November 30, 2013

Assigning colors to database records, for use in Calender views

We have now enabled an option to show entries in calendar view with configurable background and text colors in your favorite online database builder.

To use this feature, you need to add 2 new attributes and provide them with aliases as backgroundColor and textColor. You can assign the colors directly in forms (selecting from a list of choice-values) or you can assign them automatically using formula.

When the calendar views are displayed, iFreeTools will check to see if there is an attribute with alias as backgroundColor and textColor within the record, and if so, it will use those attribute's values for the calendar rendering.

As an example, let us consider a database of issues, reported by customers. If the issue records had a Severity attribute, which can take values as Critical, Major, Minor, and Cosmetic and if we wanted to view the entries in the calendar, such that the background color is based on this Severity, using the following colors for those severity values :

Severity : CriticalMajorMinorCosmetic

Then, we can add formula attributes to set the required color values for the records, so that they are used in the calendar view. Our sample app to showcase this new feature will similar to the issue tracker application we had built in one of the earlier walk-through, with the following attributes :
  • Title attribute as Single-line Text.
  • Description attribute as Multi-line Text.
  • Steps to reproduce attribute as Multi-line Text.
  • Severity attribute as Multi-line Text with choice values Critical, Major, Minor, Cosmetic & alias as severity.
  • Background Color attribute as Single-line Text with alias as backgroundColor & formula expression as :
    switch(severity == "Critical", "red", severity == "Major","orange", severity == "Minor", "yellow", severity == "Cosmetic", "lightblue").
  • Text Color attribute as Single-line Text with alias as textColor & formula expression as :
    iif(severity == "Critical", "white", "black").
  • Status attribute as Single-line Text with choice value as New, Accepted, Closed & alias as status.
  • Tester attribute as Lookup field (Reference), with Refers To as User.
  • Date Logged attribute as Date with formula expression as :
     iif(dateLogged, dateLogged, today()).
  • Date Closed attribute as Date with formula expression as :
     iif(status == "Closed", iif(dateClosed, dateClosed, today()), None).
Now assuming we also wanted to mark the closed issue as green, the formula for Background Color can be changed to be similar to the one given below :

iif(status == "Closed", "green", switch(severity == "Critical", "red", severity == "Major", "orange", severity == "Minor", "yellow", severity == "Cosmetic", "lightblue"))

The configuration of the Attributes is given below for reference:



We can now proceed to add entries into the issue records and they would get assigned with background and text colors based on the formula expressions we have specified.

The following image shows the calender view with some sample entries having the configured background and text colors.


Existing entries will have to be re-indexed once (from under More Actions > Re-index, in the list views) to have the formula attributes updated.

Hope you like the new feature. Feel free to let us know your feedback and suggestions.