If you are choosing specify data source as ODBC in Import Records script step, you can directly write your SQL query for retrieving data from external data source and those retrieved data can be imported to your Filemaker table.
You need to follow few steps for that.
i) It will ask for choosing datasource name in Import script step. So you need to create data sources in File> Manage External Data Source section in Filemaker before that. ii) After selecting a datasource in Import script step it will ask for UserId and Password. iii) Then it will open a mini window where you can see 2 options as
Calculated SQL text
—- In “Calculated SQL text” section you can use Filemaker variable while writing SQL syntax for any dynamic value passing to create SQL query.
Example: Set Variable [$findStatus; Value: “‘planning’,’In Progress’,’On Hold’,’Approved’,’Complete'”]
In Import step write syntax in “Calculated SQL text” as “select ID,CUSTOMER,TITLE,ISSUE,DATE,STATUS from MAGAZINE where STATUS IN (” & $findStatus & “)”
—- In “SQL text” section you can’t use any Filemaker variable while writing SQL syntax Example:
In Import step write syntax in “SQL text” as select ID,CUSTOMER,TITLE,ISSUE,DATE,STATUS from MAGAZINE where STATUS IN (‘planning’,’In Progress’,’On Hold’,’Approved’,’Complete’)
Note: In specify Import order the “Source fields” orders are same as your select statement fields so you can map accordingly with your “Target fields”