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 5846 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have a cabinet shop.

We build our cabinets in millimeters but need to communicate in inches & fractions.

A lot of times a customer wants to know if a particular pot will fit inside a drawer box. I would like to develop a solution that answers this question.

I need to be able to start with a drawer face dimension in millimeters, subtract drawer bottom thickness and inform the customer how much useable height they have in inches & fractions.

I am using the following formula in my calculation:

Let ( [

fraction = Mod ( decimal ; 1 ) ;

sixteenths = Round ( fraction * 16 ; 0 )

] ;

Case ( Int ( decimal ) ; Int ( decimal) )

&

Case ( Int ( decimal ) and sixteenths ; "-" )

&

Case (

sixteenths ; Choose ( Mod ( sixteenths ; 4 ) ;

sixteenths / 4 & "/4" ;

sixteenths & "/16" ;

sixteenths / 2 & "/8" ;

sixteenths & "/16" )

)

)

For the most part this approach works pretty good,

It breaks, however, whenever the denominator in the fraction should be "1/2" and sometimes during rounding errors at millimeter equivalents of whole integers.

For example: 1/2 reads as 2/4 and when the answer gets close to a whole integer the formatting gets stupid.

For example: Subtracting a 1 inch drawer bottom from a 152mm drawer face yields an answer of 4 4/4.

If you are interested, you can see examples of this on the attached file.

I got this formula from another question that was answered about four years ago on this forum by Comment.

http://fmforums.com/forum/showtopic.php?tid/152662/fromactivity/myposts/

Can anybody tell me how to recode this formatting to keep the integers cooperating?

Thanks,

Jarvis

convert_drawers.fp7.zip

Posted

Hm. Try it this way:

Let ( [

n = Round ( decimal * 16 ; 0 ) / 16 ;

sixteenths = 16 * Mod ( n ; 1 )

] ;

Case ( Int ( n ) ; Int ( n ) )

&

Case ( Int ( n ) and sixteenths ; "-" )

&

Case ( sixteenths ; Choose ( Mod ( sixteenths ; 4 ) ;

sixteenths / 4 & "/4" ;

sixteenths & "/16" ;

sixteenths / 2 & "/8" ;

sixteenths & "/16" )

)

)

Posted (edited)

Thanks Comment,

I can sense we are closer but not quite there.

The fraction 1/2 is still displaying as 2/4.

I have rebuilt the file in case you might have time to look at it.

Jarvis

Convert_fractions.fp7.zip

Edited by Guest
Posted

The fraction 1/2 is still displaying as 2/4.

Of course it is - because that was the requirement then. You started with eights or sixteenths only, and later the quarters were tacked on as a patch. I can only repeat what I said then: "when you make something for a specific purpose, then adapt it, it may end up being less efficient than making it for a general purpose to begin with."

I am not sure what your current requirement is, but perhaps this example of a general formula might suit you:

http://fmforums.com/forum/showpost.php?post/187542/

Posted

Comment,

In 2004 you stated:

"when you make something for a specific purpose, then adapt it, it may end up being less efficient than making it for a general purpose to begin with."

Your advice is durable.

Thank you so much.

Jarvis

This topic is 5846 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.