agtjazz Posted March 19, 2008 Posted March 19, 2008 I have a calculated field..... a fraction The calculation is (Let ( [ test = Mod ( cn_wtu_winter; 1 ) ; denom = Case (test ; 60 ; 15 ) ; numer = Case ( test ; Round ( cn_wtu_winter * 4 ; 0 ) ; cn_wtu_winter) ] ; numer & "/" & denom ) I need to create a new field (easy peezy).... but this field should be the lowest demonitator fraction. So instead of 3/15 the new field should read 1/5. Any advice? Thanks in advance
Søren Dyhr Posted March 19, 2008 Posted March 19, 2008 Michail has threaded these paths: http://edoshin.skeletonkey.com/2006/01/fraction_approx.html#more --sd
David Jondreau Posted March 19, 2008 Posted March 19, 2008 (edited) I was just about to post that link! Add that custom function and change your calc to something like... Let ( [ test = Mod ( cn_wtu_winter; 1 ) ; denom1 = Case (test ; 60 ; 15 ) ; numer1 = Case ( test ; Round ( cn_wtu_winter * 4 ; 0 ) ; cn_wtu_winter) smaller = Min(denom1; numer1); greater = Max(denom1; numer1); factor = GCD(smaller; greater); numer = numer1/factor; denom = denom1/factor ] ; numer & "/" & denom ) PS: It makes a bit more sense to modify the CF by adding the Min(), Max() bit in there instead of in your calc. Edited March 19, 2008 by Guest
Recommended Posts
This topic is 6153 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now