AnsweredAssumed Answered

Passing Field Names to ExecuteSQL

Question asked by theOtter on Jun 18, 2014
Latest reply on Jun 18, 2014 by theOtter

Title

Passing Field Names to ExecuteSQL

Post

     I’m trying to check for values in all user fields in a record, but ignore auto-entry and global fields. I’ve used ExecuteSQL( ) to get a comma-separate list of the appropriate field names and place it in a FileMaker variable called $FieldList, but when I try to parse that field list into a second ExecuteSQL( ) statement, I get a parse error. What am I doing wrong?

     Here’s a sample of the value I’ve got stored in $FieldList:

     description, nameGeneric, nameBrand, IDNumber

      

     For the second calculation, I’ve tried:

     ExecuteSQL(
      
        "SELECT ? FROM Product " &
      
        "WHERE \"__kplt_ProductID\" = ?";
      
        ""; ""; $FieldList; Product::__kplt_ProductID
      
     ) //end ExecuteSQL
      
     …and…
      
          ExecuteSQL(
           
             "SELECT " & $FieldList & " FROM Product " &
           
             "WHERE \"__kplt_ProductID\" = ?";
           
             ""; ""; Product::__kplt_ProductID
           
          ) //end ExecuteSQL

      

     I’ve even tried a nested SELECT statement, but that didn’t work either.

     Any ideas?

Outcomes