Long URLs in FileMaker
If you have a long URL in FileMaker, it is no problem. You could just have a button to open the URL from a text field. However, if you export the same URL to a PDF to circulate the information to others who don’t use FileMaker, you can hit problems.
The same URL in a PDF
Above is the same URL in a PDF, exported from FileMaker. It looks like it should work fine. If you click on it, however, you will have a broken URL. The problem is that the URL spans two lines of text and the PDF readers often become confused by this.
Clicking on the URL results in a ‘Page Not Found’ Error.
Adobe Acrobat Reader, or Preview on the Mac, will clip the URL to the first line, effectively breaking the link and making things complicated for the person trying to view the information from the PDF. Of course a savy user would know to copy the entire link and paste it into their browser, but that move is beyond the capabilities of some users and you want to make things easy.
Updated ‘Shorten URL’ FileMaker demo database
Regular readers of this blog will recall I wrote on the topic of URL Shortening in FileMaker recently, and created a demo database that does just that. I have updated this database to include a new script, designed to copy and paste into any solution.
Copy the script called ‘Shorten URL using Bit.ly’ into your database.
Launch the database and go into ‘Manage Scripts’. Click on the second script and copy it. Go to your own database and paste it in the same area of your own solution.
Add a new field to your database called ‘Shortened URL’
Make it a text field.
Copy the hidden Web Viewer from the demo database into your own database.
This Web Viewer is already named ‘URLShorteningWebViewer’ to match the named web viewer object in the script you copied in the first step. It is also set up to be semi invisible to minimize screen clutter. Add this to whatever layout you are going to do your processing on in your own database.
Edit the Script – just two fields to update
There are just two fields to change in the script. The field you are pulling the original long URL from and the field you want to put the shortened URL into. Edit the script step for the first field to match your starting URL field. Then use the newly created ‘Shortened URL’ field for the second field.
Set a Script Trigger onto your URL field
To make the script dynamic, and assuming you are using FileMaker 11, create a script trigger on the starting URL field. If you don’t have FileMaker 11, use a button to cause the script to run.
Set the Script Trigger to run OnObjectExit
Click on ‘OnObjectExit’ and select the script ‘Shorten URL using Bit.ly’ in your solution. Then click OK.
Tabbing from the field causes the script to run
Now, when you add a URL, as soon as you leave the field, it will get a shortened URL. You could also create a batch script to run through a group of URLs to add shortened URLs to a group of records.
Download the demo database here.