8 Replies Latest reply on May 1, 2012 6:14 AM by robdownunder

    conditionally format similar portal rows

    robdownunder

      Title

      conditionally format similar portal rows

      Post

      Hello all,

      I'd like to be able to conditionally format rows of a portal that share a common field but can't figure out a way to do it.  I can use a date field that remains the same for rows in the same 'group'.

      Ideally I'd like a visual link, such as a background colour on a field, that changes each time my date field changes.

      So, how do I map a date to a colour that can be used in a conditional formatting arangement ?

      thanks for reading.

      rob.

        • 1. Re: conditionally format similar portal rows

          Using conditional formatting would be easy for something like days of the week with monday as blue, tuesday as green, etc. since there are only 7 days in the week and you could create 7 conditionals with 7 colors. The day number of the month would require 31 different colors, doable but not by me. Days of the year 365 colors, etc. The problem could be simplified using odd and even day numbers so that you only need two colors and this is probably betteer since who can remember what light shadown green with a yellow tint means.

          Start with a calc for odd even and see if that works for you. Or one for day of the week (1-7).

          If you are using 12 some of the templates automaticaly alternate the colors of the list rows so investigating the css in the template might help.

          • 2. Re: conditionally format similar portal rows
            robdownunder

            Thanks Jack, some ideas there that I hadn't thought of.

            • 3. Re: conditionally format similar portal rows
              Sorbsbuster

              "If you are using 12 some of the templates automatically alternate the colors of the list rows" - FM11 (and maybe earlier) has as 'standard' the option to fill alternate portal rows with a different fill.

              • 4. Re: conditionally format similar portal rows
                robdownunder

                Sorbuster:  Unfortunately, I'm tryping to group multiple rows together, not alternate rows. E.g.  the first 3 rows might be the same colour, the next 2 another colour and the last another colour. The number of rows per 'group' is not fixed.

                • 5. Re: conditionally format similar portal rows
                  Sorbsbuster

                  I understand that, and Jack's ideas are very interesting.  I was only adding to Jack's comment: "If you are using 12 some of the templates automatically alternate the colors of the list rows"

                  • 6. Re: conditionally format similar portal rows

                    To group by quantity create a calculated field that produces a grouping number or use a number field and enter your own number for the group. Sort the portal by the number field to produce

                    1
                    1
                    1
                    2
                    2
                    3
                    3

                    and so on.

                    Now use your conditional coloring based on the number. You could set it for just a few colors using

                    mod(nbr;3) = 0  color 
                    mod(nbr;3) = 1 color 
                    mod(nbr;3)= 2 color

                    or

                    nbr = 1 color
                    nbr = 2 color

                    etc. 

                    • 7. Re: conditionally format similar portal rows

                      Rereading the request I see the problem. Portal rows can be set to alternate the color on an odd/even basis. You want to change the row color when the date changes in the portal row field not on any numbering schema.

                      The problem is how to determine that one date matches or is different from the date in the previous row PLUS how to determine what color to use which gives us two problems to consider.

                      A trigger might be used to store check the date field against $$_date and set the result into the flag field. Your color would be based on the flag field.

                      If the date field = $$_date the flag field = 1 and no color change

                      if the date field not $$_date then set the flag field to 0 and $$_date to date field

                      How will this will work in a portal? What are the problem? Did I supply all of the idea? How will it affect performance with a lot of records in the portal?

                      • 8. Re: conditionally format similar portal rows
                        robdownunder

                        Thanks again Jack.  Was just coming back here to describe the solution I wrote and it pretty much matches yours :-)

                        Had to add a button + script to add the grouping number to existing records, and I now call that script whenever the field that determines the grouping is exited.

                        The end result makes a big difference in the readibility of the portal.

                        I used 4 colours. Could have gotten away with just 2, but 4 proved easiest on the eye.