1 2 Previous Next 22 Replies Latest reply on Aug 16, 2013 3:03 PM by kaostika

    ExecuteSQL WHERE field_name IN ( value1, value2... ) Encoding

    martinsorich

      Dear forum members,

       

      I'm trying to figure out the encoding for a variable's value when using the "WHERE field_name IN ( value1, value2... )" clause. The IN operator allows you to use multiple values in the WHERE clause.

       

      The SQL statement for using the WHERE clause with IN operator is:

       

      SELECT column_name(s)

      FROM table_name

      WHERE column_name IN (value1,value2,...)

       

      In FileMaker, my function is configured as as:

       

      ExecuteSQL(

       

      "SELECT field_name

      FROM table_name

      WHERE field_name IN ( ? )";

       

      " " ; "¶"; $$_variable

       

      )

       

      The value in the global variable ($$_variable) is a comma delimited text string: "1000", "1100", "1200", "1300" and is passed as a parameter to the ? however this doesn't return the expected results, actually it returns NULL. I know that the arguments in my SQL statement work becasue I can take a single value (e.g., "1000") and plug it into:

       

      ExecuteSQL(

       

      "SELECT field_name

      FROM table_name

      WHERE = ? ";

       

      " " ; "¶"; "1000"

       

      )

       

      returning the correct result.

       

       

       

      How should I format the global variable containing my comma delimited value in order to take advantage of the IN operator?

       

       

       

      Thank you for your time.

       

      Martin

        1 2 Previous Next