Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7946 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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 ?

Posted

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 ?

Posted

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.

  • 2 months later...
Posted

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.

Posted

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

Posted

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)

  • 1 month later...

This topic is 7946 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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