11 Replies Latest reply on May 13, 2009 10:44 AM by philmodjunk

    Set field/object size with field value

    trialuser1111

      Title

      Set field/object size with field value

      Post

      Is there a way to set the size of a field or object based on the value of a field?  For example, if a field value is "26" could the width of that field be set to 26 pixels?

        • 1. Re: Set field/object size with field value
          raybaudi
            

          No, there isn't.

           

          But may be that there are other ways to solve your problem, if you say more about that.

          • 2. Re: Set field/object size with field value
            trialuser1111
              

            I am looking to create a very basic graphical function to summarize some data.  I figured I could create something like a basic bar graph and have the object size match the quantity of the value, but I guess not.  I suppose another potential solution would be to create an "in-field" graph, but I am not familiar enough with FileMaker functions to figure out how to do this.  Perhaps there is a way to construct a looping function that adds a "|" for every integer, so data that looks like this:

             

            Category1: 3

            Category2: 10

            Category3: 15

             

            would look like this:

             

            Category 1: |||

            Category 2: ||||||||||

            Category 3: ||||||||||||||| 

             

            Is this feasible? 

            • 3. Re: Set field/object size with field value
              raybaudi
                

              There are many ways to obtain this...

               

              For example try this calculation( result text ):

               

              Substitute ( 10 ^ Category1 - 1 ; 9 ; "|" )

              • 4. Re: Set field/object size with field value
                trialuser1111
                  

                This works perfectly!  I don't fully understand the syntax, but I'll figure that out on my own.

                 

                Thank you! 

                • 5. Re: Set field/object size with field value
                  philmodjunk
                    

                  raybaudi has given you a good, simple technique for this.

                   

                  There are more sophisticated approaches available if you are interested.

                   

                  You can set up calculations that return a graphic object in a container type field. Place a horizontal row of these on your layout and you can get a horizontal bar graph or histogram that uses colors or small icons.

                   

                  If you need really sophisticated graphing, you can probably find a plug in that will do this or you can pretty easily export the data into an Excel spreadsheet where you can then use its charting functions to graph the data.

                  • 6. Re: Set field/object size with field value
                    trialuser1111
                      

                    What types of calculations do this?  I'm looking to avoid plug-ins and custom functions because this would be needed across many computers/licenses.

                     

                    I've also realized that the original substitute function creates problems because of the scale of my data.  Some values are up in the hundreds, creating bars too long to put on my layout.  How can this be adjusted to show a percentage of the total company count (another field), so I could see:

                     

                    Total companies: 400

                    Style 1 (200): |||||||||||||||||||||||||||||||||||||||||||||||||| (50%)

                    Style 2 (20): ||||| (5%)

                    Style 3 (50): ||||||||||||||||||||||||| (25%)

                    etc.

                     

                    Or would this be more easily addressed using your container/object solution? 

                     


                    PhilModJunk wrote:

                    "You can set up calculations that return a graphic object in a container type field. Place a horizontal row of these on your layout and you can get a horizontal bar graph or histogram that uses colors or small icons."

                     


                     

                     


                    • 7. Re: Set field/object size with field value
                      philmodjunk
                        

                      Raybaudi's clever function can be adapted to "scale" the results

                       

                      First some explanation:

                       

                      10 ^ Category1 - 1 returns a "9" for every count of "Category1".

                       

                      The subsitute function then turns each "9" into a "|". That's very clever.

                       

                      So if we change the function to be

                       

                      Substitute ( 10 ^ Round(100 * Style1/Total Companies, 0) - 1 ; 9 ; "|" )

                       

                      We should get one "|" for each percent of total companies.

                       

                      My suggestion was for a way to use graphic symbols instead of text.

                       

                      • 8. Re: Set field/object size with field value
                        raybaudi
                          

                        PhilModJunk wrote:

                         

                        Raybaudi's clever function...


                        To be onest that calculation is clever but not mine; I seem to remember that it was a comment's one.

                        • 9. Re: Set field/object size with field value
                          trialuser1111
                            
                          This works very well too, and lets me work with a more definable horizontal scale, thank you!
                           Here's another wrinkle.  This works in one layout, where the categories are a pre-defined value list.  What if I wanted to apply the same technique to another layout, subtotaling by another category which is NOT pre-determined and can be one of potentially dozens of entries?  This category is a simple text field in my table. 

                          PhilModJunk wrote:

                          Raybaudi's clever function can be adapted to "scale" the results

                           

                          First some explanation:

                           

                          10 ^ Category1 - 1 returns a "9" for every count of "Category1".

                           

                          The subsitute function then turns each "9" into a "|". That's very clever.

                           

                          So if we change the function to be

                           

                          Substitute ( 10 ^ Round(100 * Style1/Total Companies, 0) - 1 ; 9 ; "|" )

                           

                          We should get one "|" for each percent of total companies.

                           

                          My suggestion was for a way to use graphic symbols instead of text.

                           


                           


                          • 10. Re: Set field/object size with field value
                            KIDO
                               Using Char ( 9618 ) or Char ( 9619 ) instead of "|" you'll get the bar graph effect. Use  colors as well.
                            • 11. Re: Set field/object size with field value
                              philmodjunk
                                

                              "Here's another wrinkle.  This works in one layout, where the categories are a pre-defined value list.  What if I wanted to apply the same technique to another layout, subtotaling by another category which is NOT pre-determined and can be one of potentially dozens of entries?  This category is a simple text field in my table."

                               

                              The basic expression works as long as the value being used as an exponent evaluates to an integer that is greater than zero. Predetermined values, calculated values, or data that is typed in al will work as long as they meet that criteria.

                               

                              "10 ^ Category1" reads as 10 raised to the power of the number stored in the Category1 field.

                              "Round(100 * Style1/Total Companies, 0)" simply insures that the exponent value is an integer in the range from 0 to 100 so as to keep things in a "range."

                               

                              Since 0 is a real value that will produce an undesirable result, I'd test for zero first:

                              If ( Round(100 * Style1/Total Companies, 0) < 0, "" , Substitute ( 10 ^ Round(100 * Style1/Total Companies, 0) - 1 ; 9 ; "|" ))

                               

                              As KIDO has posted, you can use other text characters to get different effects if you wish.