AnsweredAssumed Answered

Using PHP to 'Find' data in FMP

Question asked by shudder on Mar 8, 2011
Latest reply on Mar 8, 2011 by shudder


Using PHP to 'Find' data in FMP


Hello Folks --

I am working on my first FMP PHP Assistant generated php site.  We are in the process of web-enabling all services for one of our departments, and this includes a couple of older FMP files.  Everything is currently running on our FMP 10 server with PHP 5.2.6 installed.  Clients are using a mix of FMA 11 and FMA10.  Mac OSX (Snow Leopard).

Generating the PHP files with the assistant app was simple and easy.  I generated a full site using the included Linea template and then started making minor UI tweaks to suit our needs (swapping graphics and colors, etc.).  That all worked out well, but then I ran into an issue with the report.php or summary.php files.

The report apparently returns ALL records.  We do not want ALL records: We need active records in the system, so I need to OMIT out all Status = 'Completed' records.  This is simple enough to do in FMP itself with a simple script (see below), but I can't seem to figure out how to make this happen via PHP calls in the web browser.  The PHP files are still a bit opaque to me (sorry, still coming up to speed on PHP nomenclature in general…).

Here's the total of the very simple "Refresh" script in the user's call log:

Set Error Capture [On]

Enter Browse Mode []

Go To Layout["Main Screen" (Call Log)]

Perform Find [Restore]

If [Get (LastError)=401]

  Show Custom Dialog ["All Call Completed"; "TEXT OF DIALOG HERE..."]

  Adjust Window [Resize to Fit]

  Halt Script

End If

Sort Records [Restore; No dialog]

Go to Record/Request/Page [First]

Adjust Window [Resize to Fit]

Nothing extraordinary in there at the least.  The Restored Find in the script above has one simple search criteria:

Omit Records -- Call Log::Status: [Completed]

So, running the Refresh script returns any open call -- that is, any call not marked Status = 'Completed' (of course, the vast majority of calls in the system are Completed -- we do not need to see them in any of the report screens in the browser, but retain them for future use in the system).

What's the best way to approach this, please?  I am completely new to PHP, but am trying to learn quickly.

Do I need to call the Refresh script from my FMP db via PHP, or can I alter what is returned to the report page from the DB via tweaks to the PHP code on the summary.php or report.php pages?

Thank you in advance for shedding light on this for me.

- shudder