Execute SQL can be used with any table in your file. See these two threads for two uses of it:
But Execute SQL extracts data from your tables for display purposes. It only supports the Select statement so you need another method.
Here's a scample script that logs each time a user opens the file. You should be able to adapt it to a number of similar situations:
Go to Layout [UserLog ( UserLog ) ]
Set Field [UserLog::AccountName ; Get ( AccountName ) ]
Go To Layout [//Specify the layout you want to be the first layout that the user sees when they open the file here]
Use File Options to set this script to run anytime the file is opened. I've used a set field step purely to show where you might use Set field to update such a newly created record. Fields in such a record can actually auto-enter a number of useful bits of information such as the date, time and the account name such that just creating the new record in this table logs all that data automatically.
We use something similar to log key data in our invoicing system so that info about the employees and the invoice are secretly logged at key points in the process of creating and printing an invoice. This is to help make employee fraud a bit more difficult in our case.
That's about what I thought. I gather that the Execute SQL script step was updated in Filemaker 12 to allow you to query the Filemaker database but obviously the Select command isn't going to do anything useful in this regard.
At least I've confirmed my assumption.
Execute SQL was newly added in FMP 12. It did not exist in older versions.
But you do have a workable alternative that will do the job as I've illustrated in my previous post. The user does not see any visible change when a script patterned after this example is performed.
Yes, that will work fine.
I was just looking for something that would make for a wee bit of tidier code. With that script I require 7 script steps and 1 otherwise pointless layout to do what i could do with one Insert SQL statement.
Thanks for your input all the same.