Custom Functions Category

Custom Function: Get Number Suffix

Posted by FileMaker Pluginss in Custom Functions

Here is a useful custom function to return the suffix for a day in a month, for example if you pass it 1, it will return st, which you can append to make up a text representation of a date, eg 1st May etc.

Function Name: NumberSuffix
Function Parameters: Number
Function Code

Let( [
special_th = Case(
Mod (Number; 100) = 11 or
Mod (Number; 100) = 12 or
Mod (Number; 100) = 13; 1) ;
end = Mod ( Number ; 10 )
];
Case ( special_th; “th”; end = 1; “st”; end = 2; “nd”; end = 3; “rd”; “th”)
)

Example Input: 22
Example Output: nd
Example Usage: $suffix = NumberSuffx(22)

Custom Function: Convert Millimeters to Feet and Inches

Posted by FileMaker Pluginss in Custom Functions

I was asked by a colleague the other day for a custom function to convert millimeters into a readable format of feet and inches, for example 1000mm = 3 ft 3 5/16″, I didn’t know of such a function so I made it myself and here it is:

Function Name: ConvertMM
Function Parameters: MM
Function Code
Let ( [
inches = MM * .03937008;
feet = Floor ( inches/12 );
inches = Mod ( inches ;12 );
num = Floor(inches);
sixteenths = Abs(Floor((inches - num) * 16));
ret = Case ( (Mod(sixteenths; 2) =1) ;num & " " & sixteenths & "/16" ;
sixteenths = 2 or sixteenths = 6 or sixteenths = 10 or sixteenths = 14; num & " " & sixteenths / 2 & "/8" ;
sixteenths = 4 or sixteenths = 12 ; num & " " & sixteenths / 4 & "/4" ;
sixteenths = 8 ; num & " 1/2" ;
num )
];
feet & ” ft ” & ret & “\”"
)
Example Input: 1000
Example Output: 3 ft 3 5/16″
Example Usage: $inches = ConvertMM(1000)