
1. Re: Working with negative fractions
philmodjunk Aug 29, 2012 12:14 PM (in response to mattbabinec)I'd use this expression to convert your fraction into a decimal:
Evaluate ( Substitute ( TrimAll ( Fractions ; 1 ; 1 ) ; " " ; If ( Left ( Fractions ; 1 ) = "" ; "" ; "+" ) ) )
I'd use this expression to convert the decimal back into eighths:
Let ( [ d = cDecimalValue ;
s = If ( d < 0 ; 1 ; 1 ) ;
i = Abs ( Int ( d ) ) ;
num = (Abs ( d )  i ) * 8 ] ;
s * i & " " & num & "/8"
) 
2. Re: Working with negative fractions
mattbabinec Aug 29, 2012 3:30 PM (in response to mattbabinec)Hi,
Thank you for this, It's much cleaner than my solution.
It works great for fractions with integers both negative and positive, however when I work with a negative fraction without an integer, I still get a negative decimal result, which is great, but when i conver that negative decimal back to a fraction, I dont get a negative fraction.
Example: I put 3/8 in "Fractions" it returns .375 in "Decimal" and in DecimalBacktoFraction i get 0 3/8 when it should be 0 3/8
Here is another sample file.
Any thoughts?
Thanks.

3. Re: Working with negative fractions
philmodjunk Aug 29, 2012 3:40 PM (in response to mattbabinec)Let ( [ d = cDecimalValue ;
s = If ( d < 0 ; 1 ; 1 ) ;
i = Abs ( Int ( d ) ) ;
num = (Abs ( d )  i ) * 8 ] ;
If ( i ; s * i & " " & num & "/8" ; s*num & "/8" )
) 
4. Re: Working with negative fractions
mattbabinec Sep 1, 2012 3:59 PM (in response to mattbabinec)Thank You, that works great!
I've now run into another problem related to this..
I've created a sub summary report and want a sub summary displayed in fractions.
I created a summary field that totals up the decimal fields, which are created by the first fraction to decimal calculation you posted.
I then created another field that converts the decimal summary back into a fraction with your second formula. I've placed both these in a subsummary part in my layout, and the summary decimal field behaves as expected, onyl totaling the sub section, but the fraction field only the total of the entire found set, not the sub sections.
Here is a PDF of my report, showing what I mean.  The decimal on the right is the summary field of the decimal values created from the fractions in the "Pages" Collum.
Any advice?

5. Re: Working with negative fractions
philmodjunk Sep 4, 2012 11:51 AM (in response to mattbabinec)When you refer to a summary field in a calculation, it computes an aggregate value (total, average, Standard deviation, etc) for the current found setexactly what you describe.
Use the getSummary function to get a subtotal instead of the grand total.