3 Replies Latest reply on Jan 6, 2015 6:13 AM by philmodjunk

    SQL Queries in Filemaker Pro 12

    AlainJanquart

      Title

      SQL Queries in Filemaker Pro 12

      Post

      Hello,

      I need to filter data out of a current FM database.

      The purpose is to have a combobox with values. Every time the combobox is changed, I need to dispay the result of my query using the value of the combobox.

      I added the combobox with the values.

      Now I want to have a script that executes the SQL code and displays that under the combobox.

      How can I achieve that? I have no experience in FM.

       

      Thanks in advance

      Greetings

      Lainkes

        • 1. Re: SQL Queries in Filemaker Pro 12
          philmodjunk

          Hmmm, well we have pop up menus and drop down lists--neither are exactly the same as a "combo box" found in other systems.

          FileMaker does not use SQL as the standard option for querying the DB in order to pull up a record set such as is found in other relational DB systems. Other methods are used to do that or we find a way to use the rather limited ExecuteSQL function call to produce that result.

          But you do not describe what you mean by "the script that executes the SQL code and displays that under the combo box". What exactly do you want to see happen on the screen once you have selected a value from the value list? Do you want to see a list of records where a specified field contains or is equal to the value selected in the combo box?

          • 2. Re: SQL Queries in Filemaker Pro 12
            AlainJanquart

            Yes, that's what I want.

            Normally I program in Delphi. There I have a list/combo component with values. When I change that, a grid with records is refreshed and will display the new result of my query.

            But I guess it's not so easy in FM. I already managed to make a report that is returning all the records of my table. That's already a start.

            Now I want a system to change that report, so that only the records who match a value of the listbox are shown.

            Lainkes

            • 3. Re: SQL Queries in Filemaker Pro 12
              philmodjunk

              Actually it's easier to do in FileMaker as you do not need to put together an SQL query to do that.

              The simplest way is to set up your value list formatted field with a global field. Then use one of the simple find scripts shown as examples here: Scripted Find Examples

              In some cases, depending on the design of your value list and what fields/data you set up in your table, to use a portal to show the matching records and your value list formatted field serves as either a match field in the relationship to the portal's table occurrence or a field referenced in a portal filter that is defined as part of the portal's set up. In this case the field might not need global storage and it might work without any scripting at all.