FileMaker: Getting Live Exchange Rates

Filemaker-iconThis technique uses Applescript and cUrl to get the current exchange rate between two currencies. The results are returned to a field within FileMaker.

For this we’re using a database called PRODUCTS and a temporary global field called Temp 001, so change these accordingly for your database.

Continue reading

FIleMaker: Fixing The Annoying Error 101

Filemaker-iconWhen creating loops that traverse through all the records of a found set, most all of us use the useful “Go to Record/Request/Page [Next; Exit after last]” function. It’s quite nice, since it prevents a loop from continuing into infinity when you reach the last record of a found set. However, you will always get an Error 101 from this.

Error 101 is telling us that the record we want is not found. For this case, the record we want is the next record, which doesn’t exist because we’re already at the end. You would think the built in function would suppress this error when you select to option to exit after the last record, but the error still gets logged, and will pop-up if we use the debugger window or if we are running a server script.

What can we do?

We we have two choices: ignore the benign error or use another method. I chose the latter, a method that won’t trigger the error.

Continue reading

FileMaker & Applescript: Force a remote user commit

Filemaker-iconWhen editing a live FileMaker database, we’ll sometimes need to force clients to commit their records before the update can happen. If our users are on remote machines, this can be a real problem. The general fallback approach is to send a disconnect request from the FileMaker Server. This will close the database the client is using, so it isn’t the most friendly method.

If you are a computer admin with the credentials to ssh into these remote machines, you can perform a polite Applescript that will commit the current record without most users even noticing. Simply remote connect to the machine using Terminal, then rum the following command:

osascript -e "tell application \"FileMaker Pro\"" -e "tell database \"Products\"" -e "set cr_id to current record's ID" -e "show first record" -e "show record ID cr_id" -e "end tell" -e "end tell"

In this example, I am using a database called “Products”, so please modify the script as your needs require.

This solution requires knowledge of usernames and passwords, so it is not ideal in all situations. A more integrated approach would be to add either a timer for auto commit, or using a special command in filemaker to force users to commit. I will write about both when time permits.

FileMaker: More Useful Date Fields

Filemaker’s date field is not very kind to users

especially ones that like to type instead of using their mouse to select a date. If a user wanted to enter in “10” for the date, with the logic that “10” is the day of the date of the current month, they would be prompted with this error:Image

It is a little more wordy than it needs to be, as it should simply say, “Please re-type your entry in MM/DD/YYYY format.” We can avoid this problem all together by adding in a script trigger to our field, but first we need the script to trigger.

Continue reading