7 Replies Latest reply on Feb 12, 2012 4:14 PM by comment

    Display data from two fields as a fraction

    allanthered

      I know I am overlooking something somewhere but I need to display numbers from two fields as a fraction(not a decimal) and I need this to be a number so I can have summary field to insure that all of these records total to 1.

        • 1. Re: Display data from two fields as a fraction
          comment

          Perhaps you could provide an example - I could read this in several ways.

          • 2. Re: Display data from two fields as a fraction
            datastride

            Allan (I think that’s your name),

             

            If I understand your goal, you’ll probably need two calculated fields, both of which would be defined in terms of your two “source” fields.

             

            The first of these calculated fields could be defined as text, and would be used for display purposes to give you something like “25/50” (without the quotes, of course).

             

                 Table_Name::Calc_Field_Text = GetAsText( Table_Name::Numerator_Field ) & “/” & GetAsText( Table_Name::Denominator_Field )

             

            The second of the calculated fields would yield a number computed by dividing the numerator by the denominator to give you a number such as .50.

             

                 Table_Name::Calc_Field_Number = GetAsNumber( Table_Name::Numerator_Field ) / GetAsNumber( Table_Name::Denominator_Field )

             

            You could sum the “Calc_Field_Number” field in all the appropriate records to determine if the total was, in fact, 1.

             

            If you like, you could probably find or write a custom function to simplify fractions like “25/50” to “1/2”, or “75/100” to “3/4”. Of course not all fractions could be simplified, but for many common instances you could probably make the text field a bit prettier this way (if that has any value in your application).

             

            Peace, love & brown rice,

            Morgan Jones

             

            FileMaker + Web:  Design, Develop & Deploy

            Certifications: FileMaker 9, 10 & 11

            One Part Harmony 

            Austin, Texas • USA

            512-422-0611

            • 3. Re: Display data from two fields as a fraction
              allanthered

              Data Fields are Unit Acres which is constant for a project  say 350

                                      Acres owned which varies by individual  assume 8 landowners owning 75, 110, 25, 35, 50, 20, 15, 20 acres

                                  Data feild fractional interest a caculated feild  Acres Owned/Unit Acres

                                            which would be displayed as  75/350, 110/350, 25/350, 35/350, 50/350, 20/350, 15/350, 20/350

                                  and as total which would be displayed as ideally 1 or 350/350

              • 4. Re: Display data from two fields as a fraction
                allanthered

                Is this the proper place to say thank you

                • 5. Re: Display data from two fields as a fraction
                  datastride

                  Of course. And you're most welcome.

                   

                  You could also create a calculated text field to display the sum as either "1" (if in fact the total was 350/350 or 1.00), or as a fraction such as "347/350" (if the total was not 1.00). This would help you quickly see how many acres were unaccounted for.

                   

                  So assuming you had already defined two summary fields to total all the numerators and all the denominators in a group:

                   

                  Table_Name::Display_Total_as_Text =

                  Case

                  (

                  Table_Name::Summary_Total_of_Numerators = Table_Name::Summary_Total_Denominators ; "1" ;

                  GetAsText( Table_Name::Summary_Total_of_Numerators ) & "/" & GetAsText( Table_Name::Summary_Total_Denominators )

                  )

                   

                  Peace, love & brown rice,

                  Morgan Jones

                   

                  FileMaker + Web:  Design, Develop & Deploy

                  Certifications: FileMaker 9, 10 & 11

                  One Part Harmony 

                  Austin, Texas • USA

                  512-422-0611

                  • 6. Re: Display data from two fields as a fraction
                    comment

                    allanthered wrote:

                     

                                            Acres owned which varies by individual  assume 8 landowners owning 75, 110, 25, 35, 50, 20, 15, 20 acres

                    If you enter the actual acres owned, e.g. 75, 110, 25 etc. then this could be very simple, as there are really no fractions as such here.

                    • 7. Re: Display data from two fields as a fraction
                      comment

                      Or, if you prefer presenting a fuller picture: