Speed Up Loops with Freeze Window

Posted in Scripts

When running a loop script which is processing lots of records, redrawing of the window to show the updates can take a while, so if you call the Freeze Window script step before starting the loop, no window updates are performed and loops will finish quicker.

It is advised to goto a layout with a please wait message or something and then return to the original layout after the loop has finished.


Calculation: Is Leap Year

Posted in Calculations

This simple calculation returns a boolean of wether the current year is a leap year or not.

Case(
IsEmpty(Current Date), TextToNum(""),
Mod(Year(Current Date),4) = 0
and
Mod(Year(Current Date),100) <> 0
or
Mod(Year(Current Date),400) =0 , 1, 0
)

Force Fields to be Uppercase

Posted in Calculations

Sometimes you may want a field to always be in uppercase characters, however the user may input it. It is possible to just format a field to show the text as uppercase, but the actual field data would remain in lower or mixed case.

To actually force the data to be uppercase we can use an auto-entered calculation.  Open the Manage Database dialog (File > Manage > Database…) and open the options for the field you want to change.  In the Auto-Enter section check the ‘Calculated value’ checkbox and when the calculation dialog opens, type Upper(FieldName) replacing FieldName with the name of the field, or if you are using FileMaker 9 you can use Upper(Self) which automatically uses the current field.

Click OK and then make sure you uncheck ‘Do not replace existing field value (if any)’, otherwise it won’t work.  Close the field options and now all data will automatically be changed to uppercase when the field is exited.


Script Function: Get(DesktopPath)

Posted in Scripts

When you are automating exports of user data from a FileMaker file, the easiest place for the user to be able to find the exported file at a later date is on the desktop.  How can you export a file there?  Using the Get(DesktopPath) script function!

It returns the path to the desktop folder with a trailing slash ready for you to append a filename to, for example:

$file = Get(DesktopPath) & “export.xml”

Would return something like ‘/C:/Documents and Settings/Username/Desktop/export.xml‘ on a Windows machine and something similar to ‘/MacintoshHD/Users/Username/Desktop/export.xml‘ on a Mac.

If you save it to a variable you can then use it in an export path to enable dynamic export paths to the user’s desktop, without having to know their platform and system username.


Easily Duplicate Layout Objects

Posted in Layouts

When designing a layout in FileMaker you quite often want an object to look exactly the same as another, for example when laying out lots of fields.  You could use the Duplicate menu command in the edit menu, or the keyboard shortcut for that, Ctrl + D / Command + D.

Another, even easier way is to just hold down the Control key on PC (or Option key on a Mac) whilst dragging the layout object you want to duplicate and a ‘+’ sign will appear next to the pointer to show that you are duplicating the control and not just moving the original, which it would do if you weren’t holding down control/option the whole time you are dragging the control.

If you do accidently let go of the modifier key before you finish dragging and then end up moving the original control instead of duplicating it, you can easily reverse the change by using the Undo command in the Edit menu, or use the keyboard shortcut Control + Z (Command + Z on Mac)


Alternate to Sending Email Other Than Send Mail

Posted in Scripts

If for whatever reason you don’t want to use the Send Mail script step, you can achieve the same by using the Open URL script step as well.

Just use something like the following as the address:

“mailto:” & Email_Address & “?Subject=” & Subject & “?Body=” & Message

Where you change Email_Address, Subject and Message to hardcoded values, variables or fields.

It will open up a new message to be sent from the default installed mail client the same as the Send Mail step does.


Custom Function: Convert Millimeters to Feet and Inches

Posted 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)

Set Default Layout Object Settings

Posted in Layouts

When in layout mode if you find yourself repeatedly adding fields for example and changing the formatting each time, you’ll be happy to know you can make each new item the same!

To change the new layout object defaults you just have to Ctrl+Click (Command+Click on Mac) on the field you want to copy the settings and formatting for to the defaults.  Now all newly created items will be exactly the same.


Free FileMaker Plugin – MooPlug

Posted in Plugins

MooPlug is a multi-purpose plugin which adds many useful functions to FileMaker.  It is still an early version with only support for the Windows platform, but an OS X version is planned for the future.

Some of the current functionality includes Zip extraction and compression, FTP Upload and download, File, Folder, Font and Colour Dialog showing as well as file and folder creation, copying, moving and deletion.

I think over time as more user requested features get added to it, this free filemaker plugin will become even more popular!

Website:  MooPlug.com


FileMaker 9 Released

Posted in News

FileMaker Inc have announced the release of the latest products in their range, FileMaker 9!  There are over 30 new features since FileMaker 8.5, which we will be covering in more detail over the next few weeks.

It still uses the same .fp7 file format, so you can happily use a mix of clients from FileMaker 7 upto FileMaker 9, but obviously newer features won’t be available in the older versions.

Some of the noticable changes:

  • A completley redesigned Script listing, including grouping and searching of scripts.
  • Conditional formating, allowing you to dynamically change the formating of fields.
  • Full SQL access to external databases.
  • a PHP site assistant to help non-advanced users created a FileMaker powered PHP website.