2 Replies Latest reply on Jan 21, 2013 11:12 AM by Hudi

    Use of IN operator with ODBC import

    Hudi

      Greetings,

       

      What is the correct way to import using the IN operator?

       

      Suppose I'm trying to import the sql table called 'student' and I don't want to import every single record in that SQL table.

      I only want the ones where FMTable::Student_id = Sql Student_id.

       

      What i tried so far is to create an array in Filemaker using a custom function AddConstantToListValues http://www.briandunning.com/cf/516 , slightly modified to return 'value1','value2'. etc.

       

      So, inputing this into the calculated sql text

      "SELECT * FROM Student WHERE 'student_id' IN (" & AddConstantToListValues ( $list ; "'" ) & ")"

       

      Returns this:

       

      SELECT * FROM Student WHERE 'student_id' IN ('10','1000','10000','10006','10007','10008','10009','1001','10011','10012','10014','10015','10017','10019','1002','10022','10023','10024','10025','10027','1003','10032','10033','10034')

       

      I am however getting zero records imported even though there records in the sql database that have these id's.

       

      Any ideas?

       

      Thanks!