When I attempt to use Get:
WHERE shipments.shipdate >= Get ( CurrentDate ) - 5 (in brackets or not)
results in:
ODBC Error: [Actual][SQL Server] 'Get' is not a recognized function name.
Main Topics
Browse All TopicsIs there a Now() or equivalent function in Filemaker Pro 7 (Mac) that would allow me to build a SQL query to select only records with a date of "right now" and 5 days before?
Right now I have: WHERE shipments.shipdate >= '03/01/2006' and I would like to replace that hard date with a "Now - 5" expression.
I am accessing a SQL server db via ODBC...
Any ideas?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
hang on, hang on!
are you querying filemaker from another database or querying another database from filemaker?
get(currentdate) is a filemaker function, and then works only when filemaker is querying a foreign database, but it cannnot be used as such in the query.
a SQL query in filemaker is a text string therefore it should be like:
"WHERE shipments.shipdate >= " & year(Get ( CurrentDate )-5) & month (Get ( CurrentDate )-5) & day (Get ( CurrentDate )-5)
for an ISO date
I should remember to be more specific...
I am importing data from SQL via ODBC by using Filemaker's "Import Data --> ODBC Data Source" function. I specify the ODBC connection data, and am then taken to Filemaker's simplified query builder. The results of this query are imported into a Filemaker table, where it is then shared. Everything is working great, just looking to have that dynamic date.
My current query looks like:
SELECT "ShipmentItems"."MainRefer
FROM (ShipmentItems INNER JOIN Shipments ON ShipmentItems.ShipmentNumb
WHERE shipments.shipdate >= 3/01/2006 AND Shipments.UpdatedStatus< 2
order by shipments.shipdate DESC
Forgot the dashes in between date strings:
"WHERE shipments.shipdate >= " & year(Get ( CurrentDate )-5) & "-" & month (Get ( CurrentDate )-5) & "-" & day (Get ( CurrentDate )-5)
If you do the query fromp another base to filemaker, which language do you use as this may slightly change:
see also this thread:
http://www.experts-exchang
OK, in this case, yr date format depends on the queried database, so you must reformat the filemaker date got from
Get ( CurrentDate )-5
as a compatible format for SQL, and that should be what I wrote in my previous post.
Not 100% sure, it may follow the US domestic format if your example if March 1st instead of January 3rd, in which case it would be:
month (Get ( CurrentDate )-5) & "-" & day (Get ( CurrentDate )-5) & "-" & year(Get ( CurrentDate )-5)
Should work also work with a '/' instead of '-' if yr example works.
Do you type this query directly in the SQL import dialog box or use a script? 1st solution won't work, it is supposed to be raw text and is not interpreted.
Make a script which uses:
import records/ specify data source / calculated SQL txt.
There you stick in yr complete query including the Get() which will be interpreted before execution.
true, you must know the names you are querying from.
actually, you can copy/paste the query from the wizard you use once.
and it shows you the fields to take/calculate values from them, and insert them in the query like getting a date, or the complete query (which is my method most of the time. Most of the time you use that to concatenate the constant and variable part of a query; in yr case the variable will be the date from get(currendate) which a function, not a field, but it could also have been from a field entered by the user before querying.
so consider this as a tool to build up the query before executing it, and it is either static using the wizard / typing it by hand or interpreted if you use the calculated SQL text. In this last case only, functions and records will calculated or replaced by their actual value at execution time.
am I clear?
This is the query that I am trying to paste into the Calculated SQL text screen. FYI- The name of my Filemaker table (that this query is populating) is named "ODBC"
SELECT "ShipmentItems"."MainRefer
FROM (ShipmentItems INNER JOIN Shipments ON ShipmentItems.ShipmentNumb
WHERE shipments.shipdate >= Get (CurrentDate) - 5 AND Shipments.UpdatedStatus< 2
order by shipments.shipdate DESC
try this:
"SELECT ""ShipmentItems"".""MainRe
FROM (ShipmentItems INNER JOIN Shipments ON ShipmentItems.ShipmentNumb
WHERE shipments.shipdate >= " & (Get (CurrentDate) - 5) & " AND Shipments.UpdatedStatus< 2
order by shipments.shipdate DESC"
forget to mention that if you need a mix, you shoud concatenate using & like:
"This is my name: " & myname_field
Same thing applies to queries, it is just a bit more confusing since you have quotes all over the place. single quotes should be accepted with most ODBC drivers also. in this case, it is easier to read, you could use:
"SELECT 'ShipmentItems'.'MainRefer
FROM (ShipmentItems INNER JOIN Shipments ON ShipmentItems.ShipmentNumb
WHERE shipments.shipdate >= " & Get (CurrentDate) - 5 & " AND Shipments.UpdatedStatus< 2
order by shipments.shipdate DESC"
Business Accounts
Answer for Membership
by: lesouefPosted on 2006-03-08 at 10:42:02ID: 16136835
use: Get ( CurrentDate )
Depending on the SQL server type, you may have to reformat this date as ISO format, ie today would be 20060308.
to extract such a string, you can use:
year(Get ( CurrentDate )) & month (Get ( CurrentDate )) & day (Get ( CurrentDate ))
the filemaker date = numbers of days since 01/01/0001, so [now - 5] simply is [Get ( CurrentDate ) - 5]