Jump to content

ExecuteSQL


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

Recommended Posts

Hey Guys,

i've got a filemaker script which uses the execute sql command a couple of time to retrieve data which is contextless.

i now need to port/convert that FileMaker script So it works with PHP API. When i've worked with the API in the past there was no command equivalent to execute sql, is it still the case - or is there a work around to this. Worse case scenario is for me to create a FileMaker script and get the api to perform script and store the result in php variable. However really wanted to keep php scripts isolated from my FM scripts.

Thanks in advance

 

Link to comment
Share on other sites

Effectively an API call works a lot like an ExecuteSQL - you should be able to write in PHP to work the same...

eg

Let([
query = "select\"Agreement No\", \"Customer ID\", \"End Date\", \"Agreement Type\", \"Status\", \"Created\"
	FROM Agreements
	WHERE Agreements.Status = ?
	ORDER BY \"Agreement No\" ";
result = ExecuteSQL( query ; "," ; ""
	; "Current")
];
result
)

Would be the same as going to a layout with 6 fields listed, based on the Agreements TO, then finding the Status = Current and sorting by Agreement No....

Link to comment
Share on other sites

12 hours ago, Jalz said:

i now need to port/convert that FileMaker script So it works with PHP API. When i've worked with the API in the past there was no command equivalent to execute sql,

 

You don't have to use the PHP API, you can just make an ODBC connection to FMS from PHP if you prefer...

 

Link to comment
Share on other sites

12 hours ago, Jalz said:

i now need to port/convert that FileMaker script So it works with PHP API. When i've worked with the API in the past there was no command equivalent to execute sql, is it still the case - or is there a work around to this. Worse case scenario is for me to create a FileMaker script and get the api to perform script and store the result in php variable. However really wanted to keep php scripts isolated from my FM scripts.

 

You can call a script from the web publishing engine as well, which includes the PHP API. You could also use something like Simple FM (https://github.com/soliantconsulting/SimpleFM) as an alternative, but they both use WPE.

Just remember there is a little extra overhead when running a script via WPE, since it builds up a session for globals and variables and such when it runs your script.

Also make sure your script is safe to run server side, and provides the correct context explicitly.

Mike

Link to comment
Share on other sites

This topic is 2822 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.