sql.debug ( )

Function stats

Average user rating
5.0000
57
335
9999
Support
FileMaker 10.0 +
Date posted
28 July 2012
Last updated
28 July 2012
Version
Recursive function
No

Author Info
 Andries Heylen

10 functions

Average Rating 4.9

author_avatar



 

Function overview

Prototype

sql.debug  ( _executeSQL )


Parameters

_executeSQL  the ExecuteSQL() function call


Description

Tags:  Sql   Debug  

This function will help you to debug your SQL statement if it returns a "?". Unfortunately this technique only works in the dataviewer (and not even with the "Edit Expression" window open, so you need to click on "Monitor" first).

Actually what we discovered is that when you send an ExectuteSQL ( ) calculation to a custom function, when evaluated in the dataviewer, you will actually see the error returned by the internal FQL engine of FileMaker.

Examples

Sample input

sql.debug ( ExecuteSQL ( "SELECT unexistingfield from table" ; "" ; "" ) )


Sample output

The column named "unexistingfield" does not exist in any table in the column reference's scope.

 

Function code

If (

//the sql call results in an error, return empty so the error will be returned
_executeSQL = "?" ; "" ;

//the sql call is executed correctly, just return the result
_executeSQL
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/335

    Prototype: sql.debug( _executeSQL )
    Function Author: Andries Heylen (http://www.fmfunctions.com/mid/57)
    Last updated: 28 July 2012
    Version: 2.2

*/
// ===================================

 

Comments

Fabrice
28 July 2012



how the f... did you discover this?
great !
  General comment
Andries Heylen
28 July 2012



Working with Andreas on MagicValueList, and suddenly I saw this error message in his dataviewer :-)
  General comment
shin
29 July 2012



Wow, that's cool!
  General comment
Mr Vodka
31 July 2012



Nice find Andries!
  General comment
rych
24 February 2013



Hello, I am new to FMPro but have plenty of rdbms/sql experience.
Can you explain how one might use this function?
I've created a 'Calculation' field in a table and attempted to write a multi-table aggregation (using SUM()), but I get a '?', and am trying to debug.
Being unfamiliar with FMP, I'm not sure how to actually use this function.
Also, google suggests that 'Data Viewer' may only be available in FMP Advanced.
Can this be used in the base FMP program?
If so, how?
TiA for any further direction you can give !
  General comment
Andries Heylen
24 February 2013



you need filemaker pro advanced for this custom function... sorry. the data viewer is indeed only available in fmpro advanced.
  General comment
liz
07 October 2013



how can i use this function?, is necessary install?, i am novice in filemaker. thanks.
  General comment
tmorrow
03 July 2014



Ok. Struggling here. How to use it. I put the code in a function. Then I have a script step that sets a variable to sql.debug(my query) but when I use script debugger and data viewer I never see the error. Anyone know what I may be doing wrong?
Thanks
  General comment

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (31)
Date  (28)
XML  (26)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (12)
Layout Objects  (11)
Filter  (11)
Design  (10)
Array  (7)