Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

import from SQL Server

Featured Replies

I am working on a solution to pull data out of SQL Server database into FM v6.

I would like to make a script that will be activated automaticaly everyday using a plugin. The problem is that as it's going to be automatic I have to keep in a global field the last importing date so that when the script is activated again it doesn't import the same records. I know that programing in other languages it is possible to keep the last importing date in a variable and the query would be something like this :

SELECT * from customers where date > '"lastimport"'

lastimport would be the variable.

I can't find a way using FM to make an importing ODBC script use a variable.

Can someone help me ?

Check the use of Global fields as variables. Use the "SetField()" Script-step.

Hope this helps.

Garry

  • Author

What I don't understand is how to use this global field in the Select statement. The query builder only shows the colums or values to be entered. How can I make the query builder have a global field in it ?

the querry should be build in a text field. lets call the query SQLtext. and the date field startdate.

in the script that runs every day use the setfield command for example

setfield(SQLtext, "select invoicenumfrom invoicetable where invoicedate > " & startdate)

then do an import based on the variable SQLtext.

I hope this helps.

  • Author

Thanks .

  • 2 months later...

All well and good, except how do you do a SQL statement using the field? That's what I've been struggling with. I can't seem to find any help on putting FM field content directly into any query.

From Jerry:

setfield(SQLtext, "select invoicenumfrom invoicetable where invoicedate > " & startdate)

This is in an FM Script. The field is "startdate". Other fields can be concatenated into the string with "&".

Hope this helps.

Garry

So you mean to say that setting the field in a script step will set the import query for me... weird - how do I invoke the import then? There must be a place where the datasourcename, UID & PWD is set...

setfield(SQLtext, "select invoicenumfrom invoicetable where invoicedate > " & startdate)

The DSN, UID and Password are set when you create the Script step "Execute SQL" (not "SetField").

All the best.

Garry

  • 1 month later...

What plug ins or version do I need to do an "Execute SQL" script step? I can't seem to find it in filemaker 5.0

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.