4 Replies Latest reply on Sep 26, 2012 1:33 PM by MorkAfur

    Confused about using a field in a table for a pop-up menu



      Confused about using a field in a table for a pop-up menu


           I have a Projects table with "Project 1", and "Project 2".

           When I select to have these two projects appear using the actual field (using "Values from") in the projects table in a pop-up menu, everything's fine.... at first.

           However, when I go to another layout and then come back to the projects pop-up menu (on the project's layout), the Project 2 field was overwritten and now also says "Project 1". I think the issue is when I select the second project in the pop-up menu, that it's somehow writing back to the projects table instead of just being a pick list.

           The only way I seem to be able to get the desired behavior is to create a static projects list.

           So, how do I use a table's field (like project description with multiple rows in the project table) to create a pop-up list to pick from, but without FMP overwriting the project table when the user picks a project name from the picker?

           Thanks in advance.


        • 1. Re: Confused about using a field in a table for a pop-up menu

               You'll need to describe your layout, table and what you want to do with this pop up menu in a bit more detail.

               When you open Manage | database | Fields, do you have a table named Projects with two field definitions, Project 1 and Project 2?

               When you click these two field objects on your layout while in layout mode, what do you see for each in the "Display data from" box found on the Inspector's data tab? Do you see different names for each or the same exact text?

               What are you doing when you select a project from the value list?

               Searching for a record for that project? Filling out data for a new record for that project? Or ???

               Why do you have two fields, Project 1 and Project 2 instead of just one field named Project?

          • 2. Re: Confused about using a field in a table for a pop-up menu

                 Thanks for your reply, Phil.

                 OK, here's some clarification on what I posted initially. Sorry it wasn't clear.

                 The idea is to have a "project name" picker from which to take the user to the correct layout, filter the projects for him based on what he selected from the picker (pop-up).

                 I created a test project that also demonstrates what I was writing about. In that sample project, I created a table called Test, and a table called Projects. There's a field called listValue. In that table, I have five records: Project1....Project5 in the corresponding ListValue fields. I told FMP to use the ListValue field to populate the pop-up (using Display Data From).

                 Then, when running the test application initially, the five project records appear as expected in the drop down. Fine. But, as I click on them over and over, FMP is overwritng them in the DB. After several clicks of different items in the pop-up, Project5 is gone and I have multiple records with Project2 and Project4. I have no idea what FMP is doing!

                 What I am trying to do is simply populate a "picker" (pop-up) with fields from the tables so the user can select one and then I can use that selection to continue in the application. There's no expectation on my part that any field data (in the ListValue fields) would be overwritten. A "picker", "pop-up", or whatever, should just be read-only, but that's not what's happening.

                 If I create a static list with hard-coded values, then FMP doesn't overwrite the values in the pop-up.

                 As to your question above, there's only one field to click on, the pop-up field shown -- see attached. The image below shows that "Project5" is no longer in the list. The actual database data for the 5 records show duplicate values for those shown below.

                 I'm clearly missing something basic here so I'd appreciate any insights on this.

                 Does this clear up my initial posting?

                 Thanks again in advance,


            • 3. Re: Confused about using a field in a table for a pop-up menu

                   For starters, you need two fields one where you identify each project and which then serves as a source of values for you value list and a second field where you select the project in your drop down so that selecting the value does not modify the name of the current project record.

                   Open manage | database | fields and add a new field called gProjectSearch. Use field options to give it global storage. The script that I am about to suggest requires it to have this storage option.

                   Put gProjectSearch on your layout. Format it with your value list. The value list should be set up with the "use values from a field" option and it should specify the original project name field.

                   Now, when you select a project name from the drop down, you don't also change the name of your current project.

                   Use manage | scripts to create this script:

                   Enter Find Mode []-->clear the pause check box
                   Set Field [Yourtable::ProjectName ; Yourtable::gProjectSearch]
                   Perform Find[]

                   When you select a project in the drop down and then perform this script, it will find the project record with the name that you specified. You can automate this by using the OnObjectSave script trigger on the gProjectSearch field to perform this script, then selecting a project in the drop down is all you need do to jump to the project record with that name.

              • 4. Re: Confused about using a field in a table for a pop-up menu

                     Thanks Phil,

                     Thanks for this insight into how FMP works. This was counterintutive to me.