If the information needed to decide what date range to use isn't available on the SQL server, you'll need to get it from FileMaker. You can do this by creating your SQL query string using FileMaker string calculations. Using a script or calculated field, you create the SQL query string by piecing together chunks.
For example, suppose you have a FileMaker field called "FM-LastExportDate", and you want to use a query like this:
select * from orders where orders.date_added > some-date-from-filemaker
or orders.date_modified > another-date-from-filemake
To submit this string with the date value filled in, use the option to get the SQL query from a calculation, and use string concatenation to build the actual text of the query string.
SQLQueryString = "SELECT * FROM ORDERS WHERE Date_Added = " & FMDateAdded & " OR Orders.Date_Modified = " & FMDateModified
Now the SQLQueryString field contains the query needed to return the newest results, based on values in FileMaker.
This is more awkward to describe than it is to actually do.
Main Topics
Browse All Topics





by: billmercerPosted on 2006-02-28 at 10:26:36ID: 16067852
Is this the exact query string you're using? As written, it's looking for all records with dates greater than their own dates, which doesn't really make sense. It needs an actual value to compare the Date_Added field to. This could be an actual static value, or the result of some sort of calculation. That calculation could be done on the SQL server, or could also be done within FileMaker.
= 1) OR...
Does the SQL server have a flag or indicator field to show whether or not it has been imported into FM? If so, you can probably do the calculation on the SQL server. You could use a subquery and the max() function to supply the date for comparison, which might look something like this...
WHERE "Orders"."Date_Added" > (SELECT MAX(Some_Date) FROM
Orders where Orders.Flagged_As_Exported
> doesn't keep different "versions" of the order...it only overwrites data as it's updated.
Does this mean your SQL server is actually re-using the same order record for multiple different orders? Or are you just saying that a given order can be edited or modified in-place?