4 Replies Latest reply on Apr 26, 2017 4:31 AM by hadleigh

    SQL: Select records from a table


      Greetings All


      I am looking to add a line into the following code to select only records that match the following criteria

      • I have a variable set called: $additional_settings
      • The field that needs to match with $additional_settings is called _kf_uuid_companys

      the code that i have already is as follows, i need to add a line into this code to pick records where the field _kf_uuid_companys matches $additional Settings.

      Any help would be greatly appreciated:


      "SELECT " & $dyn_sql & ", '" & $$record_delimiter & "'" & " FROM \\"" & $sync_table & "\\"" & " WHERE " &

      // Exclude records flagged for sync exclusion. "( COALESCE ( BS_Exclude, 0 ) = 0 ) " &

      // If the client is merging new/updated data with data already on the device... // Only include records that have been added/updated since the last pull... // And only include data that they did not just push (i.e. no "round tripping!")... If ( ( $$sync_method = "Merge" ) and ( $last_pull_utc > 0 ); "AND ( BS_UTC_Time > " & $last_pull_utc & " ) " & "AND ( COALESCE ( BS_Device_ID, 'X' ) <> '" & $client_persistent_id & "') "; "" )

        • 1. Re: SQL: Select records from a table

          "......WHERE \"_kf_uuid_companys\" = ?", "", ""; $additional_settings)


          Is this what you are looking for?

          • 2. Re: SQL: Select records from a table

            Hi Bigtom


            Thank you very much for the reply.


            Unfortunately i cannot get it to work. I am very very new to the SQL side of things.


            When adding your where statement i am getting the message that an operator is missing.



            I have attached three screenshots to show how i have added the statement, the error displayed, and the highlighted area from the error....





            [1] New line added.jpg


            [2] Error Displayed.jpg




            [3] Highlighted area from error.jpg

            • 3. Re: SQL: Select records from a table

              first I need to clarify:

              1. are you looking at a SQL database and sending an Import records script step?


              2. are you looking at FMS as a SQL source and issuing a query to it?


              3. are you trying to write an ExecuteSQL() function to a table occurrence (table alias) that you have on your FileMaker Relationship graph?


              There is not enough information, can you supply a little more, please?


              • 4. Re: SQL: Select records from a table

                Hi Beverley


                Thanks for taking the time to have a look at this.



                I have a filmmaker database which is hosted on Filemaker Server. I am now getting into allowing users to add data from mobile devices and as such the mobile devices need to sync to the server.


                The mobile device asks a script to be performed on the server to do an SQL query on the data to ensure that the correct data is sent back to the mobile device.




                If the one line under the //BIGTOMS addition is removed then the sync does work. However information is sent back to the mobile device for all companies stored rather than the individual company that the mobile user wants the data of.




                I am looking for an addition to the above calculation to further narrow down the data to only include only the data relevant to the company that the user is interested in.






                I hope that this makes sense.





                Thank You