8 Replies Latest reply on Feb 23, 2010 9:16 PM by RickWhitelaw

    DISPLAYING STATUS PERCENTAGE BAR

    ekloeselvp88

      Title

      DISPLAYING STATUS PERCENTAGE BAR

      Post

      If I had 4 fields and each one of these fields have a pop up menu that displays "done, started, and " "", is there a way i can develop a Status percentage bar.  For example is 2 of the fields said "done" then this status bar would display an image showing a bar with 50% of it filled up, or if 3 of the fields were at "done" then it would display 75% of the bar filled up. 

       

      I was thinking their would have to be some if, then calculations involved and various different images created that might have to go in a container field but I am having a hard time figuring things out.

       

      Any help?

        • 1. Re: DISPLAYING STATUS PERCENTAGE BAR
          philmodjunk
            

          With 4 such fields, you could use 4 container fields in a related table or four global container fields to store 4 images for 0%, 25%, 50% and 100%.

           

          Then you can use a calculation field set to return "container" (drop down in left corner of specify calculation dialog),

           

          Let ( DoneCount = ( Field1 = "done" ) + ( Field2 = "done" ) + ( Field3 = "done ) + ( Field4 = "done" ) ;

                  Choose ( DoneCount ; gZeroPct ; gTwentyFivePct ; gFiftyPct ; gOneHundredPct ) )

           

          Where the fields starting with "g" are your global container fields.

           

          In a networked environment, you might store these in a table of two fields: Count, ImageContainer

           

          Then you can link it via 'count' to your main table by this calculation: ( Field1 = "done" ) + ( Field2 = "done" ) + ( Field3 = "done ) + ( Field4 = "done" )

          Set to return Number as its type.

          • 2. Re: DISPLAYING STATUS PERCENTAGE BAR
            ekloeselvp88
              

            Sorry if I seem to ramble back and forth a lot just typing as i think of the problems.  First off I didn't do anything with the below because I didn't understand what you were saying here, which could have set into motion the other problems I am having?

             

            Then you can link it via 'count' to your main table by this calculation: ( Field1 = "done" ) + ( Field2 = "done" ) + ( Field3 = "done ) + ( Field4 = "done" )

            Set to return Number as its type

             

             

            And then see below...

             

            I just tried this but lets move this down to 3 fields.  Field "A1" ,Field "A2", and Field "A3" all fields have pop up menues that contain " " ", DONE, STARTED"  Then I have a fourth Field "Percentage" which is what I want to display one of the status bar images.  Then I have FOUR global container fields titled "G_0PERCENT" , "G_25PERCENT" , "G_50PERCENT" , and "G_100PERCENT"  The global fields all contain status bar images displaying "0" , "25%" , "50%" , and "100%" respectively. 

             

            I used this calculation 

            Let ( DoneCount = ( A1 = "DONE" ) + ( A2 = "DONE" ) + (A3  = "DONE ) ;

                    Choose ( DoneCount ; G_25PERCENT ; G_50PERCENT ; G_100PERCENT ) )

             

            Problem is this No matter how many of the fields have "DONE" in them Field "Percentage" only displays the 25% status bar it does not over ride to 50% if I select "DONE" in Field "A1" and Field "A2". 

             

            Further more if I were select "DONE" in Fields "A1, and A3" would it just display the G_100percent"  or will it select the G_50percent"  Because ultimately what I would like this to do is when I have any two of the three fields set to done it would select the 50% image or any one field it would select the 25% image. 

             

            I hope I am not getting too confusing here.

             


             

             

             

             

            • 3. Re: DISPLAYING STATUS PERCENTAGE BAR
              philmodjunk
                

              Choose works from a 0 index count of the value in the first parameter.

               

              Choose ( 0 ; G_25PERCENT ; G_50PERCENT ; G_100PERCENT ) will return G_25PERCENT

              Choose ( 1 ; G_25PERCENT ; G_50PERCENT ; G_100PERCENT ) will return G_50PERCENT

               

              and so forth. That tells me that ( A1 = "DONE" ) + ( A2 = "DONE" ) + (A3  = "DONE" ) is evaluating to zero--which should only be the case if none of these fields has the single word "DONE" stored in it. Note that any additional characters in these fields such as a space or carriage return will change your results as "DONE" does not equal "DONE " (Note space after the E.) (You might also check for any missing quotes as this can mess things up as well.)

               

              BTW 2 out of 3 fields with DONE should represent 66% shouldn't it?

              • 4. Re: DISPLAYING STATUS PERCENTAGE BAR
                ekloeselvp88
                   I figured out I was using the wrong field as a referance.  Thanks for explaining as well it is helping me learn!!  And you are right on the law of averages haha, maybe my problem begins at ground level...math haha.  But actually I was just putting as to what I had my fields at at the time, hope you don't think I am too much of an idiot about to fix all the fields now that I now how to fix the problem.
                • 5. Re: DISPLAYING STATUS PERCENTAGE BAR
                  mrvodka
                    

                  I would handle this differently. Things like this is a good use for repeating fields. You can store the image into a global container field with 4 repetitions. for your 25, 50, 75, and 100%.

                   

                  Then a calcuation as such ( with container result ):

                   

                  Let ( r = ValueCount ( FilterValues ( List ( Field1; Field2; Field3; Field4 ); "Done" ) ); gImage [r] )

                   

                  will return the proper image.

                   

                   

                   

                  If you want something more elaborate, you can take a look at this thread.

                  http://fmforums.com/forum/showtopic.php?tid/195086#289522

                   

                   

                   

                   

                  Edit: added link

                   

                  • 6. Re: DISPLAYING STATUS PERCENTAGE BAR
                    ekloeselvp88
                       What is the benefit to doing it this way?
                    • 7. Re: DISPLAYING STATUS PERCENTAGE BAR
                      philmodjunk
                         Both work, I like Mr Vodka's use of ValueCount ( FilterValues ( List ( Field1; Field2; Field3; Field4 ); "Done" ) as it's easier to work with should you need to add/remove fields in the future.
                      • 8. Re: DISPLAYING STATUS PERCENTAGE BAR
                        RickWhitelaw
                          

                        Also by conditional formatting on a field with 100 (very skinny) repetitions. I know this is a little vague as a result of the "field names". I use this 'tho, and it took a while to configure it. I use it on a field named "Bar" and the formula causes the repetitions to be green. I then overlay another instance of the same field, invert the qualifiers, and cause those repetitions to be red. When the result is under a certain number . . . green. Over the number . . . red.I found this in a free demo called "Simple Bar Charts.fp7". I've been searching the web for it and can't find a URL. Sorry . . . it "gives great bar chart" 'tho.

                         

                        Let([value = Extend(your non-repeating field);

                         

                        scale = another field;

                         

                        scaled_value = value/scale;

                         

                        fill = Get(CalculationRepetitionNumber)  ≤ scaled_value * 100 and Get(CalculationRepetitionNumber) ≤ your other criteria field * 100];fill)