ExecuteSQL – Date Formats

The problem.

SQL, including the new ExecuteSQL calc function in FileMaker 12, returns dates in this format: YYYY-MM-DD. This can be a bit of a pain if you have a string of text like this and just want to transform the date part:

1170 - 2012-03-09 - - Keep: Beta Presentation @ BRN Co
1171 - 2012-03-15 - 08:30:00 - Call Arthur Murray to finalize data
1172 - 2012-03-16 - 12:30:00 - Conference call with Melinda
1173 - 2012-03-20 - 11:15:00 - @ Breakfast

The calc for the results above looks like this: ExecuteSQL ( “SELECT id, DateStart, TimeStart, Summary from SampleEvents” ; ” – ” ; “¶” )

The solution.

Jason Young discovered that you can cast the dates as text in your results simply by concatenating them with a bit of text, so instead of using just the field DateStart in your query, you can use ” || DateStart to get this:

1170 - 3/9/2012 - - Keep: Beta Presentation @ BRN Co
1171 - 3/15/2012 - 08:30:00 - Call Arthur Murray to finalize data
1172 - 3/16/2012 - 12:30:00 - Conference call with Melinda
1173 - 3/20/2012 - 11:15:00 - @ Breakfast

The calc for those results looks like this: ExecuteSQL ( “SELECT id, ” || DateStart, TimeStart, Summary from SampleEvents” ; ” – ” ; “¶” )

Yes, FileMaker supports concatenate in it’s select statements.

Hope that helps.

FileMaker 12 Layout Tricks: Hiding Tabs

If you wanted to use a tab control on your layout but hide it from your users, you used to have to cover it with another tab and/or make the tab text very small. This is because you both have to visually hide the tab AND prevent users who actually click on it’s tab controls from activating it. While this worked, the layouts were kind of hard to use in layout mode: it was often hard to find the tabs at all.

Fortunately this is a lot easier in 12. And not only because tab controls work in layout mode(!).

Here is how we’re hiding tabs now.

1. Create the tab as you normally would, but make the tabs big and readable so you can find them in layout mode.

2. Turn the fill and line colors off for the tab.

3. Conditionally format the text to only show in layout mode. (You can conditionally format tab text in 12). Use this calc…

Get ( WindowMode ) ≠ 4

…and when that is true, turn the text size to 300pt, effectively hiding the text.

4. So far we’ve hidden the tab. To disable it in browse mode, create a simple script with one step called “Disable Tab Control”. Create the following steps:

If [ isempty ( Get ( ScriptParameter ) ) ]

Exist Script [Result: 0]

End If

Don’t forget that result = 0 in the exit script line.

5.  Now add an OnTabSwitch script trigger to your tab, calling this script with a script parameter of “Get ( ScriptName )”. This will disable the tabs when they are click by hand in browse mode, but they’ll work when a script is directed to them using Go To Object Name (because there will be a script parameter passed in as the script name).

Best of all, the tabs are easy to read and select in layout mode:

Layout Mode

Browse Mode

Here is a short video of this in action, and there is a great article on the new tabs in 12 on Daniel Wood’s weetbicks blog. Enjoy.

FileMaker 12: Why SQL? (Context Independent)

Simplify and Stay on Screen

FileMaker 12 lets us run SQL queries against our own FileMaker tables. This has been possible with plugins for a while and a number of serious devs like Mike Lee, Greg Lane, and Kevin Frank have been talking about what a great technique this is. I completely agree and think the new ExecuteSQL calc function is the killer feature of FileMaker 12.

Before SQL

There are a few reasons for this and I hope to get to write about more of them. But for now, consider the following simple script that checks to see if any records match a given ID:

Before SQL (click for a larger version)

There is nothing really wrong with this script and in fact it comes from our FileMaker 10 calendar. But look at all the work we have to do to make sure we’re in the right context to perform the find. We have to:

  • Record our current context and find criteria
  • Draw a new off-screen window
  • Navigate to the new layout / context
  • Execute our find, recording the outcome
  • Close the off-screen window and return to our original context with the results

Kind of complicated. And frustrating to debug as the action is happening off-screen.

After SQL

Now take a look at the same script in FileMaker 12:

SQL Version (click for a larger image)

Because the new ExecuteSQL calc function lets us search for records independent of context, we don’t need to manage layouts and windows. We can just ask FileMaker if the records exist. Fewer moving parts means simpler scripts, which means more stable solutions: no question about it.

(For what it’s worth, we could have written that as just one line, putting the ExecuteSQL calc in the ExitScript result, but I find these things are easier to debug if you can look in the script debugger for $sc_Result before the script exits. That way, I can alter it right here if I need to.)

Learning SQL

FileMaker’s new ExecuteSQL function only accepts versions of the SELECT statement so there isn’t that much SQL to learn But it does support joins, union, and groupby, so if you already know your way around this stuff you’ll be rewarded. If you don’t, SeedCode will soon be releasing a free tool to help. (You’ll love it.) If you’re not getting our newsletter, sign up here to be notified as soon as we ship.

And if you’re wondering what you can possibly do with just the SELECT statement (which returns lists of matching data), think Virtual List and stay tuned.

FileMaker 12: SQL in our Free Calendar

We’re thrilled to announce our new Free Calendar Template for FileMaker 12. We’ve rewritten the free calendar to take advantage of some of the new things in FileMaker 12, including the new look and feel, but perhaps most importantly, the new ExecuteSQL function.

This makes the new calendar simpler, less dependent on context, and easier to integrate.

Checkout this short introduction demonstrating how this new SQL stuff makes things simpler:

Now download a copy of the new calendar and dive in or learn more about our calendars.

(And if you’re looking for some more detail on how we made that cool little “x” toggle in the interface, we describe that here. It’s a great little switch that is super portable. That video will also give you a sneak peak into our new Pro calendar for FileMaker 12. Coming soon!)

FileMaker Go Performance

David Knight of Angel City Data has put out a great webinar for FileMaker on performance tuning your FileMaker Go solutions.

Needless to say, for “the ultimate performance” he endorses using the solution locally and syncing to the server using GoZync. (Thanks David!)

David also has a nice shout out to Jason Young’s 2011 DevCon session on making FileMaker Server your super user.

Watch the webinar.

Learn more about GoZync.

GoDraw: markup photos in FileMaker Go

geist interactive has just released a new add on for FileMaker Go that let’s you draw on photos. The unlocked file comes in Free or Pro versions and is easy to integrate into your own files.

We’ve been playing with this for a bit and it is awesome!

A few highlights:

* Draw right on your FileMaker Go Screens
* Store the drawing data in your database
* Drawing works offline
* Save drawings as PDFs – attach to emails
* Draw on images, photos, and diagrams, even photos you too with the iPad

Learn more: GoDraw for FileMaker Go

Customer Videos: iCal & Google Calendar Sync

Matthew Hardy of Real Estate Success Tools has put together a great video showing off how he’s using Zulu to link iCal and Google Calendar to his application.

Great overview and a link to the video here.

And if you haven’t seen his solution, REST, before, take some time to check out the site: it’s really well done. And as Matthew says, between Zulu and FileMaker his users can now interact with REST from any platform.

Physical Calendars / SeedCode Sale

Beautiful stuff here… http://design-milk.com/2012-modern-calendars/

Especially this one from Calouette.

And if you need a shared calendar, SeedCode Calendar is on sale (and bundled with Zulu iCal Sync) though Dec 31st.

Virtual List

A lot of folks have been asking for the Virtual List example file we put together with Bruce Robertson, so here it is: VirtualList.zip

This Virtual List technique is part of what make our Calendar fast, and allows FMSearchResults to show records from different tables in the same ‘portal’. We demonstrated some applications of this at DevCon’s Year in Review in 2010 and 2011, showing how this can really speed up FileMaker displays, especially those formatted as columns, grids, or lists.

Todd Geist speaking at SOFA, Nov 2011

Todd Geist has also been speaking about this a lot, including last week in Toronto, where he demonstrated how we’re using it in Worx.

There was a also a great session on Virtual Lists at Pause[x]London. Sample files and recorded presentations here.

Are you using Virtual Lists?

Calendar as Dashboard

We have a small subset of customers who wire their calendars up to act as dashboards on big displays. I’ve always thought this was cool and someday hope to get around to making one for SeedCode, a la the great dashboard at Panic.

One of these customers asked for something pretty cool today: they wanted to be able to cycle through the different resources on the calendar (recording studios in her system), showing each one on the week view for a few seconds, before moving to the next studio automatically.

Easy with a couple simple scripts and an OnTimer trigger. Feel free to add these to your own version of the calendar: AutomatedDisplayScripts.pdf