5 Replies Latest reply on May 5, 2011 5:45 PM by henrymorris

    Portal List Box as record selector



      Portal List Box as record selector


      Hi all, You've probably answered this a zillion times - I've tried using many solutions but to no avail. I'm using FM 11. I have two tables, and want a portal in the Master table to show a selection of records in the Child table, with buttons next to them. Actually, this step is easy peasy and I've done it, complete with filtering on a certain field in the master table. Happy Days. Now, when I press a button on the portal I want to see info from the Child table appear (and be editable) in the Master Layout I am viewing. I've got the script to run, am using a global variable in Master Table to link to a copy of Child table to unique field yada yada, but it simply doesn't work. The script runs (works when I insert a beep command), but the setting of the global variable doesn't then show the related Child records. Any answers to get me over this hump would be very gratefully received. I have a raft of tools to use this technique but need a push. Thanks, Henry

        • 1. Re: Portal List Box as record selector

          On what table is your master layout based?

          What exact relationship did you define to link that table to your child table?. (I know you said you used a global field, [you said variable, but since you can't link by a variable, I'm assuming you meant a global field], but exactly how did you use it to relate to the records in the Child table?)

          Did you place fields from the child table on your layout to display the data from the child table or did you use some other fields?

          BTW, another approach is to base your master list layout on the same data source table as your portal, then use Go To Related Record or a Scripted Find to find the clicked record for your masterlist layout to display.

          • 2. Re: Portal List Box as record selector
            Hi PMJ, Thanks for the reply. Layout is based on Master table. Yes, I mean a global variable, set up in the Master table. The fields listed on the master layout that I need to view / edit come from the Child table that has the link by global variable (i.e. It should select only one record based on the value of the global field, set by the script). The portal comes from the other copy of the child table, these two are the only copies. The portal filters on a linked field in the master table (not the same field as the global field). Both child tables are linked by =. I have tried setting the global field by either field by name, and set variable, then refresh window and / or commit record. Nada. I am using the trial version and intend to purchase FMP once I can get this to work. Ten days left!! I can upload a jpg of this layout and link relationship if that makes it easier. Henry
            • 3. Re: Portal List Box as record selector
              Note, I mean that both child tables are linked to the master table, not to each other. This iPad refuses to recognise carriage returns in the text field on this forum. Sorry for that.
              • 4. Re: Portal List Box as record selector

                Global variables and global fields are two different things in FileMaker. A minor quibble, but the details can hang you in database development if you get them wrong.

                And Data Source tables and table Occurrences are two different things as well. The boxes in Manage | database | relationships are table occurrences. The tables listed on the tables tab and in tables drop down on the fields tab are data source tables. When you create a new data source table, fileMaker makes a table occurrence and a layout of the same name. I can only assume that when you say you have a "copy of the child table" you are describing two table occurrences of the same data source table.

                Let's say you have these relationships:

                MasterTable::AnyField X AllChildRecords::anyField

                Then a Portal to AllchildRecords will display all records except for any excluded by a portal filter expression on the Portal.

                Let's assume you also have this relationship:

                MasterTable::gSelectedID = SelectedChildRecord::PrimaryKey

                Where gSelectedID is a number field with global storage specified and AllChildRecords and SelectedChildRecord are two table occurrences of the same data source table.

                If you have all that set up, then you can add fields from SelectedChildRecord to your MasterTable layout and the following script can be attached to your portal's button:

                set Field [MasterTable::gSelectedID ; AllChildRecords::PrimaryKey ]
                Commit Record

                And if you want, you can select all the fields inside your portal row while in layout mode and use Button Setup... to turn the entire row to perform this script instead of adding a button next to it. That assumes you don't also need to click into the portal rows and edit them while in this portal.

                If "Table Occurrence" is a new term, you may want to check out this thread: 

                Tutorial: What are Table Occurrences?

                • 5. Re: Portal List Box as record selector
                  Ok.... figured it out.... The "monkeys and Shakespeare" syndrome more than any intelligence here... Thanks PMJ for your guidance. Henry