3 Replies Latest reply on Apr 9, 2012 10:30 AM by philmodjunk

    Calculations based on text color

    MikeProcopio

      Title

      Calculations based on text color

      Post

      I am wondering if there is a way to set a calculation to get the sum of fields, but not to include numbers that are a certain color. On my database below I have player salaries that I have a calculation that adds up total player salary. On some contracts there is a qualifying offer listed in a certain color. THe qualifying offer is not part of the contract, but an estimation and I dont need it in the calculation. As you can see I set it a certain color. Not every player has a qualifying offer. Is there a way not to include the qualifying offer in a calculation??

      Screen_Shot_2012-04-07_at_9.09.25_AM.png

        • 1. Re: Calculations based on text color
          MikeProcopio

          So in the picture above THe player Taj Gibson  has a qualifying offer in 3,178,447 in the year 2013. I want that calculationt o only add up the 2011 and 2012 salries for him because those are guaranteed. But this isnt the same for everyone as players have qualifying offers in different years so I cant set the calcualtion for all to just not add 2013. Is there a way since I have quaifying offer in a certain color to exclude it?? It may not be possible, just taking a shot in the dark 

          • 2. Re: Calculations based on text color
            GuyStevens

            I tought this was an interesting question so I tried to find a solution.

            I don't know if it's the best one possible, but here's what I came up with.

            You might want to try it out thourroughly before using it.
            Make sure the "Filter" contains all the possible color letters.

            http://dl.dropbox.com/u/18099008/Demo_Files/Color_DaSaint.fp7

            For those who only want the calculation:

            If ( Number = Filter ( Left ( GetAsCSS ( Number ) ; 28 ); "color:#FC0123456789") ; Number ; "")

            • 3. Re: Calculations based on text color
              philmodjunk

              I'd be inclinded to use a simpler approach. Add a value list formatted field that controls the color via a conditional format. You can then set up a calculation that uses IF or Case to check the value fo the value list formatted field instead of the text color. This makes for simpler code and allows you to tweak the color used without having to also modify your calculation to work with such a new color.