FractionType ( fraction )
Reports from string if a valid fraction and if improper or mixed number
Average rating: 5.0 (27 votes) Log in to vote
Brett Buchmiller None www.filemaker.com |
FractionType( "9/8" )
FractionType( "3 7/8" )
FractionType( "3" )
"Improper"
"Mixed"
"Invalid"
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Part of a library of fraction functions. Reports validity of string to represent fraction and type if valid - Mixed, Proper or improper.
Comments
Guy Elsmore-Paddock, Inveniem Jul 12, 2019 |
||
Note that this will not work with whole numbers, or numbers that are already decimals. | ||
Guy Elsmore-Paddock, Inveniem Jul 12, 2019 |
||
Here's a modified version that works for whole numbers (might work with decimals too): /* Determines format of fraction and if a valid fraction based on passed text string. From: https://www.briandunning.com/cf/1359 Required Functions: FractionNumerator FractionDenominator © Brett Buchmiller 10-2011 Portions © Inveniem 2019 (Whole Number Handling) */ If( IsEmpty(input) or (Position(input; "/"; 1; 1) < 1) or FractionDenominator(input) = 0; /* Conditional */ If( /* Conditional */ GetAsNumber(input) = input; /* When: True (input is already a number) */ "Whole"; /* When: False (input is neither fraction nor a number) */ "Invalid" ); If( /* Conditional */ Position(input; " "; 1; 1) > 0; /* When: True */ "Mixed"; /* When: False */ If( /* Conditional */ FractionNumerator(input) > FractionDenominator(input); /* When: True */ "Improper"; /* When: False */ "Proper" ) ) ) |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.