Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 6153 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

Michail has threaded these paths:

http://edoshin.skeletonkey.com/2006/01/fraction_approx.html#more

--sd

Posted (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 by Guest

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.