Search code examples
filemaker

Filemaker Execute SQL with column name


I think this is a very dumb question but I just can't find how to do it.

I'm using ExecuteSQL in filemaker but I noticed the result text doesn't contain the column name, any idea how I can make the result show column name?

Thanks in advance!


Solution

  • You could simply add a text line to your calculation, before calling the ExecuteSQL() function, e.g.:

    "SomeField,AnotherField¶" 
    & 
    Execute SQL ( "SELECT SomeField, AnotherField FROM YourTable" ; "" ; "" )
    

    Note that you can use the GetFieldName() function to protect your calculation against fields being renamed.

    You can also use a query like:

    SELECT * FROM FileMaker_Fields WHERE TableName='YourTable'
    

    to retrieve ALL field names of a table.